Vincent Plagnol
2011-Nov-18 23:14 UTC
[R] cannot set the path to installed R packages when building a package vignette
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. Thank you in advance, Vincent -- Vincent Plagnol University College London Genetics Institute Darwin building, office 210 Gower Street, London, WC1E 6BT Cell: +44-(0)7946-546923 Office: +44-(0) 2031-084002 Website: http://www.ucl.ac.uk/ugi/research/VincentPlagnol ResearcherID: http://www.researcherid.com/rid/A-5667-2011 [[alternative HTML version deleted]]
Uwe Ligges
2011-Nov-19 18:14 UTC
[R] cannot set the path to installed R packages when building a package vignette
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.
Vincent Plagnol
2011-Nov-19 19:44 UTC
[R] cannot set the path to installed R packages when building a package vignette
Uwe, thanks it worked just fine. I think I was confused by the fact that .Rprofile sets the library path properly when I use R interactively or it BATCH mode but I need to set my R_LIBS (in .Renviron worked for me) when I use "R CMD build". In any case it fixes my problem so many thanks again, Vincent On Sat, Nov 19, 2011 at 6:14 PM, Uwe Ligges <ligges@statistik.tu-dortmund.de> wrote:> > > 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@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. > > >-- Vincent Plagnol University College London Genetics Institute Darwin building, office 210 Gower Street, London, WC1E 6BT Cell: +44-(0)7946-546923 Office: +44-(0) 2031-084002 Website: http://www.ucl.ac.uk/ugi/research/VincentPlagnol ResearcherID: http://www.researcherid.com/rid/A-5667-2011 [[alternative HTML version deleted]]