[R] BATCH run library problem

Flash nobody007 at gmail.com
Fri Sep 28 15:39:40 CEST 2007


I have installed R-2.5.1 on my linux machine (Ubuntu LTS 6.01) by
compiling the source. I have no problem to install packages on my
local folder,

/home/flash/R_LIBS

And I have no problem to load the package inside of R. for example,

>library(cluster)


However, when I'm trying to run batch command, for example,

$R CMD BATCH work1.r work1.out


( work1.r file begins with library commands, like)

library(cluster)
......


then I have the following error (copied from work1.out)
> library(cluster)
Error in library(cluster) : there is no package called 'adapt'
Execution halted

I checked the environment variables.

> options("lib")
$lib
[1] "/home/flash/R_LIBS"

> Sys.getenv("R_LIBS")
          R_LIBS
"~flash/R_LIBS"

In shell, env returns many variables and I have

R_LIBS=/home/flash/R_LIBS:/usr/local/lib64/R/library.


The only way to avoid this problem is to copy cluster directory from
/home/flash/R_LIBS to /usr/local/lib64/R/library/   .

How can I fix this problem? (or do I have to copy package directory
whenever I install new one?) Thanks in advance..

Flash.



More information about the R-help mailing list