[Rd] Rprofile.site assignments occur in base package (PR#2448)

ligges@statistik.uni-dortmund.de ligges@statistik.uni-dortmund.de
Mon Jan 13 16:37:03 2003


bert_gunter@merck.com wrote:
> Not sure whether this is a feature or bug -- but it does not appear to be
> documented.
> 
> R1.6.1 on Windows NT 4.00.1381
> 
> Objects assigned in the Rprofile.site file (e.g. foo<-'something') are put
> into package:base not .GlobalEnv on startup. Objects assigned in the
> .Rprofile file are put into .GlobalEnv. This doesn't seem consistent to me.
> The objects exist in base only for the duration of the session -- they are
> not written permanently (of course). Anything in the (saved) .GlobalEnv will
> persist.


It *is* documented in, e.g., ?Rprofile:

"Then R searches for the site-wide startup profile unless the command 
line option --no-site-file was given. The name of this file is taken 
from the value of the R_PROFILE environment variable. If this variable 
is unset, the default is `$R_HOME/etc/Rprofile.site', which is used if 
it exists (which it does not in a ``factory-fresh'' installation). This 
code is loaded into package base.

Then, unless --no-init-file was given, R searches for a file called 
`.Rprofile' in the current directory or in the user's home directory (in 
that order) and sources it into the user workspace."

Uwe Ligges

> The workaround(?) is trivial: source() in a file with the assignments in the
> Rprofile.site file. Assignments in the sourced file are done in .GlobalEnv.
> 
> Cheers,
> Bert Gunter
> Biometrics Research RY 84-16
> Merck & Company
> P.O. Box 2000
> Rahway, NJ 07065-0900
> Phone: (732) 594-7765
> mailto: bert_gunter@merck.com
> 
> "The business of the statistician is to catalyze the scientific learning
> process."      -- George E.P. Box