[R] Environment variables under Windows

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Oct 10 13:15:55 CEST 2002

John Miyamoto wrote:
> Greetings,
> I have a question pertaining to the concept of "environment variables"
> that is mentioned in the R documentation for "Startup" and also in the
> discussion of the Windows configuration of R in the recent book "An
> Introduction to R" authored by Venables, Smith, and the R Development Core
> Team (referred to as VS in this message).
> The Startup documentation and VS make reference to environment variables,
> e.g., R\_ENVIRON, R_USER, or R\_PROFILE.  Apparently the R startup
> procedure operates differently depending on whether these variables are
> "set" or "unset".  What is unclear to me is how to set these variables.
> For example, is something to be done with the AUTOEXEC.BAT file or the
> CONFIG.SYS file, or perhaps one must alter the Properties of the shortcut
> icon for R?  Another possibility is that one must insert some lines in the
> RProfile file.  On my installation I have two files names RProfile.  The
> first is in the directory \rw1041\etc, and the second is in the directory,
> \rw1041\library\base\R.  Does one "set" an environment variable by placing
> an appropriate line in a RProfile file?

1) See the R for Windows FAQs
2) See ?.Renviron for details on how to set those variables in a file
like .Renviron
3) There are different versions of Windows with different approaches to
set global environment variables. In Win9x and friends it is done in
autoexec.bat, but on WinNT,2k,XP you should set it at another place.
Details hopefully in the manuals of your OS.
4) You can set it temporarily in R by using Sys.putenv() (that's
possible in Rprofile as well, but I think not recommended, just to
answer your last question).

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