unix environment variables under R
source(file.path(Sys.getenv("PROJECT"), "xxx.R"))
and please try not to expect sloppy sh-shell programming to work
in any other language.
On Tue, 29 Oct 2002, Jan Malte Wiener wrote:
Jason Turner wrote:
On Tue, Oct 29, 2002 at 10:11:09AM +0100, Jan Malte Wiener wrote: ...
thought a UNIX environment variable could be the solution, but R doesn't
seem to know about the environment variables.
e.g. >> source("$PROJECT/xxx.R") results in
Error in file(file, "r") : unable to open connection
is there something like environment variables for R?
Yep. Sys.getenv() Cheers Jason
thanks for your answer,
but how do i source a file using that environment variable; if the
environment variable holds a path to a directory and i want to source a
file within that directory??
e.g.:
Sys.putenv("ABC"="~/R-Stuff/")
in ~/R-Stuff there a bunch of R-files
now i want to source one of these R-files using the ABC environment
variable.
sorry, but i do not know how to do this ?
greetinx jan
--
Jan Malte Wiener
Max-Planck-Institute for Biological Cybernetics
Spemannstr. 38, 72076 Tuebingen, Germany
Tel.: +49 7071 601 631
Email: jan.wiener at tuebingen.mpg.de
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._