some errors
Thanks for all the help. First a summary: amongst the very many help suggestion, the best approach seems to be to use ~/.Renviron: in that file it is possible to set "environment" variables which are used even if there is no environment, such as when start the R GUI. This means that the values will be used in every invocation fo R - under shell, in Carbon Emacs, in the GUI. Now, I actually tried that out without success before my post. I have done some further research and I think I have found some kind of bug (or else something very strange). First off: I have tried everything on a Linux system running R-2.0.1 where it works as expected. My .Renviron is as follows R_LIBS=/Users/kdh/Library/R/library R_PAPERSIZE=letter R_EDITOR=/usr/bin/nano It is being parsed begause the settings affect the papersize and the editor used by R. The problem is the R_LIBS, and it is quite strange. Now, I have removed everything from my .profile as seen by grue:~ kdh$ echo $R_LIBS grue:~ kdh$ R R : Copyright 2005, The R Foundation for Statistical Computing <SNIP: R elcome message>
.libPaths()
[1] "/Library/Frameworks/R.framework/Resources/library"
Sys.getenv("R_LIBS")
R_LIBS "/Users/kdh/Library/R/library"
.libPaths(Sys.getenv("R_LIBS"))
.libPaths()
[1] "/Users/kdh/Library/R/library" [2] "/Library/Frameworks/R.framework/Resources/library" What is appearent from the transcript is 1) R_LIBS is actually set as seen by Sys.getenv. 2) This does not affect .libPaths() 3) However, passing R_LIBS to .libPaths() sets up everything correctly. This baffles me quite a lot... I think it most be a mac bug since it works under Linux (ok, on an older version, but still...) Just for completeness sake: I am running Tiger, with the R-2.1.0 patched version. I do not have administration privileges, but it seems to me that the permissions on ~/Library/ and subdirectories are as they ought to be. R is owned by root. And finally, I realized that the typo in preferences probably should be corrected to $HOME/Library/R/library (although I must add that this setting is also not reflected in .libPaths()) Kasper
On Wed, Jun 08, 2005 at 08:56:00PM -0700, Byron Ellis wrote:
Or you can just (setenv "R_LIBS" (format "%s/Library/R/library" (getenv "HOME"))) in your .emacs. You can also set your DISPLAY variable there as well. I'm sure if you were VERY enterprising you could write some elisp that would snarf your .profile, parse it and then run the elisp equivalents. On Jun 8, 2005, at 8:48 PM, Seth Falcon wrote:
Hi Kasper, On 8 Jun 2005, k.hansen@biostat.ku.dk wrote:
On the terminal as well as using ESS (Emacs) I can not get .libPaths() to include /Users/kdh/Library/R despite the fact that I have exported it from ~/.profile and the variable is set (output below). I have also tried using ~/.Renviron
I suspect the issue here is that Emacs isn't picking up your environment. GUI apps started from the Finder don't get the same environment (.profile, .bash_profile, etc.) that apps started from the Terminal do. My solution: I start my Emacs from Terminal and then it inherits the proper PATH and other env vars such as R_LIBS. There is another possible solution that involves editing ~/.MacOSX/environment.plist, but I never managed to get that working as I wanted. Best, + seth
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
--- Byron Ellis (ellis@stat.harvard.edu) "Oook" -- The Librarian
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Kasper Daniel Hansen, Research Assistant Department of Biostatistics, University of Copenhagen