[R] windows nt/access other directories/ attach/system

Prof Brian D Ripley ripley at stats.ox.ac.uk
Fri Jun 1 08:39:36 CEST 2001

On Fri, 1 Jun 2001, S.McClatchie wrote:

> Colleagues
> ----------------------------------
> System info:
> R version rw1022 on NT
> ESS v. 5.1.18 using emacs ver. 20.4
> ----------------------------------
> As recommended, I keep separate directories for projects, but also use
> separate sub-directories for types of data (e.g. different oceanographic
> instruments) within projects.
> My problem is that I often need to access the objects and data (not
> stored as objects) in more than one directory.
> I understand (mistakenly?) that at present you cannot use attach() with
> directories, just with objects and packages. Also I think

attach only concerns the search path for objects.

> system("command") is for the UNIX environment. System("cd ..") gives
> me an error under Windows NT. Obviously it is inconvenient to quit R and

False.  system() is also under NT, and if cd is in your path under NT it
works.  It just doesn't (NT or Unix) change directory for the R process.

> restart in the other directory, and messy to combine the "instrument sub-
> directories" into a giant "project directory".
> Do you have a suggestion of how to proceed, other than keeping my
> data as objects (I generally prefer to keep my data as text files so I can
> access them with Matlab when I need to).

Try help(setwd).  Or use the File | Change dir menu item on Rgui.

> help.search("directory")
Help files with alias or title matching `directory':
Type `?FOO' to inspect entry `FOO(PKG) TITLE'.

getwd(base)        Get or Set Working Directory
list.files(base)   List the Files in a Directory/Folder
R.home(base)       Return the R Home Directory
RHOME(base)        R Home Directory

might have been helpful.

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