[R] Saving workspace image

2003-10-07 Thread Ted Harding
Hi folks,

On quitting R with q(), is it possible to save the workspace
to a directory other than the one R was started from?

(I sometimes have a project master directory with the major
R code and data in that directory, but divisions of the project
having their specific stuff in sub-directories. So if I quit while
running a sub-project, I'd like to save the workspace back into its
sub-directory. I see that this could be achieved by starting R in that
sub-directory, and invoking master code as source(../whatever),
but this would be a lot less convenient than doing it the other way
round).

With thanks,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 08-Oct-03   Time: 01:00:30
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Saving workspace image

2003-10-07 Thread Marc Schwartz
On Tue, 2003-10-07 at 19:00, [EMAIL PROTECTED] wrote:
 Hi folks,
 
 On quitting R with q(), is it possible to save the workspace
 to a directory other than the one R was started from?
 
 (I sometimes have a project master directory with the major
 R code and data in that directory, but divisions of the project
 having their specific stuff in sub-directories. So if I quit while
 running a sub-project, I'd like to save the workspace back into its
 sub-directory. I see that this could be achieved by starting R in that
 sub-directory, and invoking master code as source(../whatever),
 but this would be a lot less convenient than doing it the other way
 round).
 
 With thanks,
 Ted.


Ted,

Use:

setwd(PathToDir)

prior to quitting. That will set your working directory.

Alternatively, you can always use:

save.image(PathToDir/.RData)

to save the workspace image explicitly where you want it.

See ?setwd and ?save.image

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help