17

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?

Murta
  • 2,037
  • 3
  • 25
  • 33
showkey
  • 482
  • 42
  • 140
  • 295
  • 6
    This is almost certainly answered in `?Startup`, though I will admit that the documentation there can be a bit of a slog to read through. – joran Apr 13 '13 at 03:23
  • 4
    @it_is_a_literature: you appear to be firing off questions without any clear effort of search either the R help system, or the corpus of existing StackOverflow question. That is not going to be a successful strategy. – Dirk Eddelbuettel Apr 13 '13 at 13:01

3 Answers3

7

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

IRTFM
  • 258,963
  • 21
  • 364
  • 487
1

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.

orville jackson
  • 1,868
  • 1
  • 12
  • 16
1

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.

Josh
  • 1,210
  • 12
  • 30