Skip to content
Prev 350092 / 398513 Next

R: Idea behind .First() vs. ~/.Rprofile

Hi,
On Thursday, April 16, 2015, paul <paul.domaskis at gmail.com> wrote:

            
It's the timing and where the info comes from, as that document explains in
great detail.

.Rprofile is read on start-up unless R is specifically told to skip it.

.First() is sourced after it's loaded, and thus must be loaded from
somewhere such as an existing .RData file or a package.

~/.Rprofile is thus most convenient for things you want to have happen in
every R session, while .First() is useful for specific sessions loaded from
saved objects, or for constructing packages. Though on linux, I use a local
.Rprofile if I need per-session options, because I often don't have a saved
.RData file.

Sarah