On Sat, Mar 10, 2012 at 04:01:21PM -0800, casperyc wrote:
> Sorry if I wasn't stating what I really wanted or it was a bit confusing.
> 
> Basically, there are MANY datasets to run suing the same function
> 
> I have written a function to analyze it and returns a LIST of useful out put
> in the variable 'res' (to the workspace).
> 
> I also created another script run.r such as
> 
> myname(dat1)
> myname(dat2)
> myname(dat3)
> myname(dat4)
> myname(dat5) 
> 
> For now, each time the output in the main workspace 'res' (the list) is over
> written.
> 
> I want it to have different suffix to differentiate them. So I can have a
> look later after the batch is run.

I see no advantage in having that information in variable names. Just

- add the name of the data set to the information that is included in
  the returned list.

- run your function with sapply() and the returned list of sapply will
  be a list of lists.

-- 
Hans Ekbrand (http://sociologi.cjb.net) <h...@sociologi.cjb.net>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to