[R] Storing/Restoring R objects

R. Michael Weylandt michael.weylandt at gmail.com
Wed Jan 11 21:44:07 CET 2012


R is the natural tool to operate on a .RData file: you can name it
however you wish either with your OS or with the save() command in R.

You can load any .RData files with the load() command but the startup
routine only looks for .RData (to my knowledge) unless you put
specific instructions in your .Rprofile.

What I might suggest is (if there is a natural modularity to your
project) saving the sets of relevant data frames in .RData files
(which can hold multiple objects) and then writing a little prompt to
ask your users which one he would like to load using readline(): e.g.,

cat("Here are available data sets", dir(pattern = ".RData"), "\n")
load(dir()[pmatch(readline("Which data set would you like to load"), dir())])

Does this help?

Michael

On Wed, Jan 11, 2012 at 2:56 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>  One of my projects has generated quite a few objects (data frames) related
> to one portion of this project. They can be listed with the ls() function.
> What I would like to do is move them to another directory so that data
> frames for other portions of the project can be more easily seen and used.
>
>  .RData is a binary file. Are there tools that let me work with this file?
> What if I rename it and start a new .RData file when I next invoke R? Could
> I then specify which .RData file should be available on demand?
>
>  I have not seen (or remembered if I did) discussions on this topic. Please
> advise.
>
> Rich
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list