[R-SIG-Mac] Help with running R from within Aquamacs

Simon Urbanek simon.urbanek at r-project.org
Mon Feb 11 17:20:37 CET 2008

On Feb 11, 2008, at 10:02 AM, Quan Li wrote:

> Thanks to Kasper and Simon. I was indeed wrong about where the  
> packages were stored. In R, .libPaths() returned the following:
> [1] "/Users/useradmin/Library/R/2.6/library"
> [2] "/Library/Frameworks/R.framework/Versions/2.6/Resources/library"
> the packages that came with R were stored in [2] and the packages I  
> downloaded were stored in [1]
> however, in Aquamacs, .libPaths() returned
> [1] "/Library/Frameworks/R.framework/Resources/library"
> I temporarily solved the problem by moving all the packages to  "/ 
> Library/Frameworks/R.framework/Resources/library"
> without tinkering with the .Rprofile file, is there a way to make  
> Aquamacs to point to both paths instead of just one?

I'm not sure - it depends on whether Aquamacs allows you to set  
environment variables automatically (I'm not a Aquamacs user) - if it  
does, set R_LIBS accordingly.

I know you said you don't want to touch .Rprofile, but just in case  
you change your mind, it would make it much simpler. This is what I  
use to synchronize command line R with the GUI (in .Rprofile):

if (length(.libPaths())==1) .libPaths(paste(Sys.getenv("HOME"),"/ 

The benefit of this is that this works with any command-line R,  
regardless how you start it (ssh, X11, Terminal, Emacs, ...).

> Also, when I run R from within Aquamacs, the Quartz device does not  
> work. I tested with
> a<-c(1:10)
> b<-c(1:10)
> plot(a,b)
> in R, I got a scatter plot, but from within Aquamacs, it says  
> evaluation is finished but I don't see the Quartz window. Please  
> advice.

You are probably using PostScript device by default. Set "quartz" to  
be your default device. Also I think you still have to load CarbonEL  
first (unless you're using R-devel).


>>>> Simon Urbanek <simon.urbanek at r-project.org> 2/9/2008 4:02 PM >>>
> On Feb 9, 2008, at 12:33 PM, Kasper Daniel Hansen wrote:
>> On Feb 8, 2008, at 7:23 AM, Quan Li wrote:
>>> Hello,
>>> I had a rookie question. I can load add-on packages in R but cannot
>>> do so when R is run from within Aquamacs. The error message says
>>> "there is no package labeled "lattice"", for example. All my
>>> packages are stored in R's library. Any help on this is much
>>> appreciated.
>> My guess is that you are wrong and that your packages are stored
>> elsewhere (than the system library which is /Library/Frameworks/
>> R.framework/Resources/library. A good guess would be ~/Library/R. You
>> can check this using
>> R> installed.packages()
> And even better check .libPaths() [see the FAQ].
>> A way to fix this is to make a ~/.Rprofile file containing, sat
>>  .libPaths("~/Library/R")
> I would discourage this as it won't be compatible with the R GUI
> setting. Also it is a source of many problems as people forget to
> update their packages with R version.
> Cheers,
> Simon

More information about the R-SIG-Mac mailing list