[R] .Rprofile vs. First (more of an opinion question)

Rolf Turner r.turner at auckland.ac.nz
Tue Mar 10 23:38:20 CET 2015

On 11/03/15 11:17, Erin Hodgess wrote:
> Hello again
> I am using R-3.1.2 on Windows 7.
> I am the only one using this particular computer.
> My question is probably more of an opinion question.
> I want to set a "repos" with the options.  Also, I want to setwd and load a
> particular workspace.
> Am I better off to put everything into .Rprofile, please?  Or .First?
> Or put the options into .Rprofile and everything else into .First, please?
> Thanks for any help.

How do you create your .First() function and get it into your workspace?

I may be confused here, but I think that you would need to make sure 
that this is done in each workspace (in each working directory) that you 
use.  It may be the case that you use only a single working directory, 
but it is generally good practice to use a different working directory 
for each separate project that you engage in.

In contrast, putting your settings in .Rprofile causes them to be 
applied in any working directory in which you start R.

I also think that there's more danger of .RData getting lost or 
over-written --- it is getting used all the time, whereas .Rprofile just 
sits there and does its thing once it's been created --- than there is 
of .Rprofile getting lost or over-written.

Consequently my 2 bob's worth is:  Use .Rprofile.

Of course, this is a case of the blind leading the blind.  Caveat lector.



Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

More information about the R-help mailing list