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

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Mar 11 01:51:15 CET 2015

I concur with Rolf.

.RData files (the ones with nothing before the period) are just traps for your future self, with no documentation. I avoid them like the plague. I refer to specifically-named Something.RData files in my .R/.Rnw/.Rmd files to cache results of long computations, but they are optional in my workflow because I always have R code that can regenerate them.

.Rprofile files offer consistency of behavior  regardless of which working directory you use, and you can comment them.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On March 10, 2015 3:38:20 PM PDT, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>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,
>> Thanks for any help.
>How do you create your .First() function and get it into your
>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
>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
>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

More information about the R-help mailing list