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 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.
On 11.01.2012 20:56, Rich Shepard 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?See ?save and ?load Uwe Ligges> 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.
?save ?load You may need to create single use environment objects to hold the whole file while you separate multiple objects. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. 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.
On Jan 11, 2012, at 2:56 PM, Rich Shepard 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?The R executable would be one such tool. The code is there if you want to go through it, but the unserialization process is notoriously complex. There is no counterpart to SAS Proc CONTENTS> What if I rename it and start a new .RData file when I next invoke R?Then R will not find it. (Actually there will be no .RData file until R executes save.image() at the end of the session. R does not create a fresh .RData at the beginning of a session.)> Could > I then specify which .RData file should be available on demand??Startup You can have different ,RData files in different directories.>?save ?load> I have not seen (or remembered if I did) discussions on this topic. > Please > advise.Please read more help pages. They generally have many useful links. -- David Winsemius, MD West Hartford, CT