0

I am trying to put a copy of my Rprofile from my work computer onto my home computer, but R does not seem to be able to find it.

I have tried several responses to similar questions including:

In Windows, you set the R_USER profile by opening up a command line and running:

SETX R_PROFILE_USER "C:/.../.Rprofile"

Sys.getenv("R_PROFILE_USER")
[1] "C:/Users/Sally/Rprofile"

but this does not work.

I also tried:

 candidates <- c( Sys.getenv("R_PROFILE"),
                 file.path(Sys.getenv("R_HOME"), "etc", "Rprofile.site"),
                 Sys.getenv("R_PROFILE_USER"),
                 file.path(getwd(), ".Rprofile") )

Filter(file.exists, candidates)
[1] "C:/PROGRA~1/R/R-32~1.2/etc/Rprofile.site"

I changed the location of the Rprofile file to match the Filter results with no luck.

sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

If anyone has any suggestions it would be appreciated. Thanks, Sally

user41509
  • 978
  • 1
  • 10
  • 31

1 Answers1

0

That is Windows for you -- you need to define $HOME as an evironment variable, or place it in $USER or ... whatever else they decide next.

On operating systems with an x or X in the name, $HOME is well defined and ~/.Rprofile is found.

Possible workaround: just edit $RHOME/etc/Rprofile.site but remember that this file will vanish next time you upgrade R on Windows.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725