[R] getting a windows environment variable in r

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Oct 12 18:59:32 CEST 2000

Thomas Lumley wrote:
> On Thu, 12 Oct 2000, Bob Sandefur wrote:
> > hi-
> >  I would like to get a value set with the dos set command (e.g. set dog=cow) in a rterm session on rterm 1011 under windows 2000. if I try in a dos window:
> > set dog=cow
> > echo %dog%
> You want getenv("dog")

What you get on NT or Win2k is:

> getenv("dog")

If you are defining or changing a variable in a DOS box, the changes can
only be seen in that DOS box.
Try to start a new DOS box and you won't find "dog":

c:\> echo %dog%

But it is possible to get the expected result, if you are invoking R
within the DOS box, in which you defined "dog":

c:\> set dog=cow
c:\> c:\.......\rgui.exe

> getenv("dog")

Uwe Ligges
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