showkey
showkey

Reputation: 368

What is the difference betwwen `Rprofile`,`Renviron` and `Rprofile.site`,`Renviron.site`?

In my computer:

  1. There are three files in /etc/R Renviron and Rprofile.site,Renviron.site , I can not find Rprofile anywhere. Is that a proper status?

  2. What is the difference beetwen Rprofile,Renviron and Rprofile.site,Renviron.site?

Upvotes: 21

Views: 10171

Answers (3)

IRTFM
IRTFM

Reputation: 263352

The name of the file is .Rprofile rather than Rprofile. I got this code after doing a search in SO for '[r] .rprofile' and finding this answer:Locate the ".Rprofile" file generating default options

file.path(getwd(), ".Rprofile") 
[1] "/Users/davidwinsemius/.Rprofile"

Most OSes will hide "dot-files"/"system files" unless you force them to become visible.

You will find the various files described in the ?Startup help page. The .Renviron file is supposed to describe settings and locations of system resources; from `?Startup

Lines in a site or user environment file should be either comment lines starting with #, or lines of the form name=value. The latter sets the environmental variable name to value, overriding an existing value.

So the key-value pairs will be used to push those pairs to the system environment variable table. Rprofile.site is supposed to contain code that creates starting conditions for everyone on a network, perhaps shared options such as the setting for stringsAsFactors=FALSE,

... and .Rprofile contains code that an individual user sets up and controls, perhaps user defined functions or packages to be loaded at startup.

Josh cited an answer by @flodel that deserves study: Locate the ".Rprofile" file generating default options

Upvotes: 7

Josh
Josh

Reputation: 1335

I found this article useful for answering the OPs second question, "What is the difference between Rprofile, Renviron and Rprofile.site, Renviron.site?" Essentially, Rxxx.site contains site-specific (i.e. current computer) settings, while .Rxxx contains project- or user-specific settings.

Upvotes: 1

orville jackson
orville jackson

Reputation: 1878

I had a question similar to question 2 from the OP, but specifically focused on the difference between the .Rprofile and Rprofile.site files.

Based on what I've gleaned from ?Startup and some of the other answers on SO here's my understanding of that difference:

Rprofile.site is the site-wide startup profile - it gets searched for, and run, BEFORE .Rprofile and it will overwrite the base package. .Rprofile is a user startup profile that gets searched for and sourced AFTER Rprofile.site and loads stuff into the workspace rather than overwriting the base package.

I also found this answer here helpful in understanding the difference.

Upvotes: 1

Related Questions