On 14 April 2012 at 20:45, Ben Bolker wrote:
|
| Does anyone have advice on how to instruct R CMD check to use a
| non-standard set of libraries? Here's the situation:
One way around is something like this:
edd at max:~$ tail -5 .R/check.Renviron
# edd Apr 2003 Allow local install in /usr/local, also add a directory for
# Debian packaged CRAN packages, and finally the default dir
# edd Jul 2007 Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'}
edd at max:~$
The file check.Renviron sets up R environment variables just for R CMD
check. [ And IIRC there is also build.Renviron ]
| I'm trying to do some automated checking on package dependencies of a
| package I maintain. In order to do that I've written code that takes
| the list of the dependent packages and for each package (1) downloads
| the most recent/available .tar.gz file; (2) installs the "Suggests:"
and
| "Depends:" packages for the package that are not already installed;
(3)
| runs R CMD check and stores the output.
|
| I wanted to do this in a way that would not necessarily bloat my base
| installation, so I wanted to do step #2 into a new library. Once I've
| figured out what the missing dependencies are (depMiss), I
So you could have a script setting the check.Renviron up alongside the
build-up and later tear-down of you test setup.
Would be good to publish such a set of scripts. I hacked up something much
smaller than that and much more ad-hoc too to test the reverse depends of one
of my package before uploading it.
Dirk
|
| install.packages(depMiss,lib=libdir)
|
| Then I run R CMD check as follows.
|
| ss <- suppressWarnings(system(
| paste("export R_LIBS=./library; R CMD check",
| file.path(tarballdir,tn)),
| intern=TRUE))
|
| However, this only seems to work partially. It does prevent the check
| from failing with an error that the package doesn't exist: *BUT* when
| the examples are actually run, I get results like this (this is from the
| 'agridat' package, which "Suggests:" the hglm package, which
has hence
| been installed in the 'libdir' directory).
|
| [168] "168: Loading required package: hglm"
|
| [169] "169: Warning in library(package, lib.loc = lib.loc,
| character.only = TRUE, logical.return = TRUE, :"
| [170] "170: there is no package called ?hglm?"
|
| Checking installed.packages() shows that hglm is indeed installed in
| the appropriate directory. agridat "Suggests:" hglm. The
| "crowder.germination" example in agridat tries require(hglm) and
fails;
| it therefore doesn't fit the relevant HGLM model -- when the example
| tries to reference this model a few lines later, the example fails.
| Admittedly this could be seen as a bug in the example (it shouldn't try
| to access a model it knows it can't fit), but I wonder if there's a
way
| I can get the examples run to see the non-standard package location.
|
| I could (I guess) modify my .Rprofile temporarily ... ? But I'm
| curious if there's a right way to do this ...
|
| thanks
| Ben Bolker
|
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel
--
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com