johnsonzhj
johnsonzhj

Reputation: 527

How to set the global default for R and Rstudio on Mac?

Under Mac OSX, for the general default, normally I start the terminal and use ls -al to check the availability of the .bash_profile and then use nano .bash_profile to add the necessary global default into it. But for R and Rstudio, if I want to set the global default for the input of the Chinese character with command Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8"). I use the following command to get the R_HOME

  R.home()

[1] "/Library/Frameworks/R.framework/Resources"

Then I copy the command Sys.setlocale(category = "LC_ALL", locale = "zh_cn.utf-8") into the newly created file named either .Rprofile or "Rprofile.site in the directory "/Library/Frameworks/R.framework/Resources/etc", but it seems not work for me, what's wrong for my steps? There is a close anwer to my question locate the ".Rprofile" file generating default options What's the difference between .Rprofile and Rprofile.site?

Upvotes: 1

Views: 1299

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 545618

Your question is a bit unclear but it seems that you’re asking for an equivalent to the configuration file ~/.bash_profile. That would be ~/.Rprofile. For more information, read the documentation on “Initialization at Start of an R Session”. This also answers your question “What's the difference between .Rprofile and Rprofile.site?”:

$R_HOME/etc/Rprofile.site is the site file, whereas [~/].Rprofile is the user file.

Upvotes: 1

Related Questions