1

I'm using macOS and I have a Rstudio, I always use my personal folder to work with R in Rstudio, I set the default working directory by

Rstudio -> Preference -> General -> R Session

and add

~/R

as the Default working directory.

Then I created a .Rprofile just to increase the history size by creating a .Rprofile file as:

usethis::edit_r_profile()

and the add the next line

## Increase the size of my Rhistory file
Sys.setenv(R_HISTSIZE='100000')

and then save it using the floppy icon, and it create the .Rprofile in:

~/.Rprofile

my question is, do I have to change the .Rprofile to the working directory ?

 ~/R/.Rprofile

or it has to be in home ?

~/.Rprofile

and if I want to move it to my personal working directory (~/R), how to make that Rstudio load it from my personal folder ???

Thanks

abraham
  • 661
  • 8
  • 14
  • 2
    Are you using RStudio project files? R will look for the .Rprofile page in the current working directory or the user home directory at startup. It does not look again if you change the current working directory after the session has started. Using an RStudio project file should set the working directory at startup. You can also set the R_PROFILE_USER env variable if you want to change the default behavior. See the `?Startup` help page for more info. – MrFlick Jan 17 '22 at 08:09
  • Thanks so much, I made it by using .Renviron, it works just like I want. Thanks – abraham Jan 18 '22 at 19:38

0 Answers0