[R] cannot set the path to installed R packages when building a package vignette

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Nov 19 19:14:17 CET 2011



On 19.11.2011 00:14, Vincent Plagnol wrote:
> Dear colleagues,
>
> I am having issues trying to build a R package I recently wrote.
> I am using R 2.14.0 and my package depends on another package called aod.
> Running:
> R CMD Sweave vignette.Rnw
> is perfectly fine and the vignette compiles properly.
>
> but when I use
> R CMD build mypackage
> to build the tar.gz  I get the following error:
>
>   * installing the package to re-build vignettes
> * creating vignettes ... ERROR
> Loading required package: aod
> Warning in library(pkg, character.only = TRUE, logical.return = TRUE,
> lib.loc = lib.loc) :
>    there is no package called ‘aod’
>
> Error: processing vignette ‘ExomeDepth-vignette.Rnw’ failed with
> diagnostics:
>   chunk 1 (label = load)
> Error : package ‘aod’ could not be loaded
> Execution halted
>
> I can fix the issue by inserting the following line into my vignette:
> .libPaths(c("/ugi/home/shared/vincent/libraries/R/installed", .libPaths()))
> where the path specifies the installation path to my R packages. But
> clearly this should not be part of the vignette.
>
> Basically I cannot find a good way to specify a path to my installed
> packages when I run
> R CMD build
> I cannot find the right info. I am probably being slow but if someone could
> point me to the right direction, any help would be very much appreciated.


If the packages are not on your default search path, set the environment 
variable R_LIBS appropriately before running R CMD build.

Best,
Uwe Ligges


> Thank you in advance,
>
> Vincent
>
>
>
>
>
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list