[Rd] R_PROFILE on Windows

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Dec 13 22:15:52 CET 2005


On Tue, 13 Dec 2005, Fernando Henrique Ferraz P. da Rosa wrote:

>        There seems to be a bug in the Startup section, regarding the
> R_PROFILE environment variable in Windows. If not a bug in the Startup
> itself, perhaps a bug in the documentation.

Nope, it works as documented, using exactly the same code as on Linux. 
You do not tell us your shell here (so I presume it is XP's cmd.exe), but 
you seem to have set R_PROFILE to a string enclosed in quotes (as the R 
output shows).  Try

 	RGui.exe R_PROFILE=C:/fernando/R.profile

I am in the same boat, and so I use tcsh/sh on Windows to be sure I 
understand the quoting rules.

>        According to ?Startup:
>
>       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'
>
>        On Windows XP, I created a batch file with the following lines:
>
>        SET R_PROFILE="C:\fernando\R.profile"
>        "C:\progs\R-2.2.0\bin\Rgui.exe"
>
>        On c:\fernando\R.profile I had:
>
>        options(foo='bar')
>
>        Running the batch file I created I get, in R:
>
>        > options()$foo
>        NULL
>        >Sys.getenv("R_PROFILE")
>                           R_PROFILE
>        "\"c:\\fernando\\R.profile\""
           ^^                       ^^

>
>        I've tried using slashes instead of backslashes
> (fernando/R.profile), double blackslashes (fernando\\R.profile) but it
> seems there's no way to make it work.
>
>        The only way I could manage to have R read the profile was
> renaming R.profile to .Rprofile and starting R on the directory the
> .Rprofile was located.
>
>        Is this really the intended behaviour? If so, what's the
> correct way to specify the R_PROFILE variable and have R use it on
> Windows?
>
>        Ps: I've tested it on R 2.2.0 and on r-devel r36675, on Windows
> XP SP2. Sorry if this is a non-bug. I'm a poor linux user trying to
> survive on Windows, so I might have overloooked something.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list