4
  1. I was using RStudio for my project
  2. I'm trying out EMACS+ESS as an IDE since it can also serve as latex/python IDE
  3. previously i installed R packages in D (because they take up chunk of HDD)
  4. when i started ESS the R buffer only recognized the R library in C
  5. when i started R.exe from C and used library() it recognized the library in D

EDIT
apparently i can use .libPaths("d:/libpathhere") to add a libpath but if i restarted the emacs i found that i need to run this command again to add the libpath again

from the above, it seems the R run in the ESS stored its profile in a place different with R run from C:\program files

Another Question
1. how to make R-ESS autoload my R project folder on start
2. how to permanently store the setting of that other libpath in D drive in ESS's R so that it stays recognized after restarting emacs

Firhat Nawfan H.
  • 187
  • 2
  • 12
  • 1
    For 2. add `.libPaths("d:/libpathhere")` to a file called `.Rprofile` in your home directory. http://www.statmethods.net/interface/customizing.html. For 1. do you want R to source all files on start? I'm not sure what you mean by "autoload my R project folder" – Jake Burkhead Apr 09 '14 at 12:27
  • (1) i mean my workspace folder the folder that contain r.data and r.history – Firhat Nawfan H. Apr 09 '14 at 12:31
  • It should load `.RData` by default. When you start R with `M-x R` make sure the starting data directory (in the minibuffer) is your project directory – Jake Burkhead Apr 09 '14 at 13:46

1 Answers1

0

You need to add .libPaths("d:/libpathhere") to a file called .Rprofile in your home directory. The trick on Windows is to identify where that is.

After starting R within Emacs, the R for Windows FAQ suggests running Sys.getenv('R_USER') to identify where R thinks the home directory is. That directory is typically C:\Users\username\Documents.

Now, you could put your .Rprofile file there, but that's not my preference. I set the environment variable R_PROFILE_USER in Windows to c:\Users\username\.Rprofile, or one could also set it in your Emacs init: (setenv "R_PROFILE_USER" "c:\\Users\\username\\.Rprofile"). The R documentation has more details on how R starts.