Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

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?

like image 237
showkey Avatar asked Apr 13 '13 03:04

showkey


People also ask

What is Rprofile site?

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.

Where is Rprofile site located?

Rprofile is located in the users' home directory ( ~/. Rprofile on MacOS/Linux). This . Rprofile is run whenever you start up R.

How do I create a Renviron file?

Renviron file in your Home Directory. Find your Home directory by clicking on the Home button in the Files pane of RStudio. Then, simply create a new text file (File > New File > Text File) and save it as . Renviron .

How do I edit Rprofile?

One easy way to edit your . Rprofile file is to use the usethis::edit_r_profile() function from within an R session. You can specify whether you want to edit the user or project level . Rprofile.


1 Answers

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

like image 140
IRTFM Avatar answered Oct 02 '22 20:10

IRTFM