[R] loading into a list

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Tue Apr 20 15:57:13 CEST 2004


On Tue, 20 Apr 2004 15:39:07 +0200 Tamas Papp wrote:

> I have the following problem.
> 
> Use the same algorithm (with different parameters) to generate
> simulation results.  I store these in variables, eg A, B, C, which I
> save into a file with
> 
> save(A, B, C, file="solution001.Rdata")
> 
> I do this many times.  Then I would like to load the above, but in
> such a manner that A, B, C woule be part of a list, eg
> 
> sol001 <- loadIntoList("solution001.Rdata")
> 
> so that sol001 is a list with elements A, B, C.
> 
> I am looking for a way to implement the above function. 

If your objects are always called A, B, and C, the following should
work:

loadIntoList <- function(file) {
  load(file)
  return(list(A = A, B = B, C = C))
}

hth,
Z

> The variables
> are very large and I need a lot of time to compute them, so saving &
> loading the results is the only viable alternative.
> 
> Thanks,
> 
> Tamas
> 
> -- 
> Tamás K. Papp
> E-mail: tpapp at axelero.hu
> Please try to send only (latin-2) plain text, not HTML or other
> garbage.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list