[R] Directories

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Mar 3 11:46:40 CET 1999

On Wed, 3 Mar 1999, David Scott wrote:

> I am using r0.63.2 for Windows.
> This seems like it should be a FAQ but I couldn't find it in the R FAQ.
> If I want to have different workspaces for different projects how do I
> arrange for R to restore a workspace from a directory other than the one
> where the executable is, automatically on startup? Is it possible, or do I
> have to save the workspace in the right directory then manually restore it
> from there?

First, if you were doing this on Unix/GNU-Linux or using rterm.exe, it
would be automatic, hence the absence from the FAQ.  R uses the copy of
.RData found in its starting directory, and I believe the problem relates
to how you are starting R under Windows. (I guess you must be
double-clicking Rgui.exe in Explorer.)

We advise you to make a shortcut to Rgui.exe in your project directory, and
alter its properties to give the project directory as the `Start in'
directory.  Then when you run that shortcut it loads .Rdata from that
directory, and when you finish it saves to that directory (unless you
navigate the file system using the menu dialog boxes inside R: we have
fixed that for rw0633).  All file paths will be relative to the `Start in'
directory: this is standard Windows behaviour (except that there is
probably no such thing).

If you want to load a workspace from or save to another directory you can
use load.image("somewhere/.RData") or save.image("somewhere/.RData").
You can also do this from the File menu, but beware of the .rda extensions.

I realize this information is not where it probably should be, in a FAQ in
the Windows distribution. We are working hard on documenting the Windows
version of R, but please bear in mind that as I in particular do not use R
for teaching, it is hard to know what are the problems that stem from a
lack of Windows sophistication rather than R problems. Ideas for that
R-for-Windows FAQ will be gratefully received (but to me, not R-help,

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list