[R] Storing/Restoring R objects

2012-01-11 Thread Rich Shepard

  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@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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread R. Michael Weylandt
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 rshep...@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@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.

__
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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread Uwe Ligges



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@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.


__
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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread Jeff Newmiller
?save
?load
You may need to create single use environment objects to hold the whole file 
while you separate multiple objects.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Rich Shepard rshep...@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@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.

__
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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread David Winsemius


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

__
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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread Rich Shepard

On Wed, 11 Jan 2012, David Winsemius wrote:


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.)


David,

  That's good to know.


Could I then specify which .RData file should be available on demand?


?Startup


  I'll read this.


You can have different ,RData files in different directories.


  I can make this work. Create different subdirectories for each project
portion and start R from the appropriate one.

Thanks,

Rich

__
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.


Re: [R] Storing/Restoring R objects

2012-01-11 Thread David Winsemius


On Jan 11, 2012, at 5:16 PM, Rich Shepard wrote:


On Wed, 11 Jan 2012, David Winsemius wrote:

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.)


David,

That's good to know.

Could I then specify which .RData file should be available on  
demand?


?Startup


I'll read this.


You can have different ,RData files in different directories.


I can make this work. Create different subdirectories for each project
portion and start R from the appropriate one.


It may work better to set up a .Rprofile file in those directories to  
establish the working directory pointer and do any other project  
specific tasks.


(Rich;
I usually send mail to both the list and the author of the posting I  
am responding to but I am getting static from my ISP about that  
address you are sending from.)



David Winsemius, MD
West Hartford, CT

__
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.