[R-pkg-devel] Loading Libraries Outside of .lib.loc
Bill Denney
bill at denney.ws
Wed Jun 28 22:23:33 CEST 2017
Hi,
I'm working on a script to test my library (PKNCA) for what the minimum
required version of its dependencies are. Specifically, I've received
bug reports when people are using versions of dplyr < 0.5.0.
To test my package against old versions of libraries, I'm installing old
versions of packages in separate directories with:
> dir.create("/tmp/current", recursive=TRUE)
> install.packages("devtools", lib="/tmp/current")
I then try to load the devtools library that I've just installed, and I
get an error:
> library(devtools, lib.loc="/tmp/current")
Error: package or namespace load failed for ‘devtools’:
.onLoad failed in loadNamespace() for 'devtools', details:
call: loadNamespace(name)
error: there is no package called ‘withr’
I would have assumed that lib.loc would cause R to search within the
directory I just created for the dependencies, too. But it doesn't
appear to do so:
> library(withr, lib.loc="/tmp/current")
>
(no error)
Is this intended behavior or a bug? If intended behavior, I can
manipulate .lib.loc through something like:
assign(".lib.loc", envir=environment(.libPaths),
c("/tmp/current", "/usr/local/lib/R/site-library",
"/usr/lib/R/site-library", "/usr/lib/R/library"))
Thanks,
Bill
P.S. Apologies if this would better fit on a more general mailing list,
but the only reason I'm bashing at library and install.packages is
related to package development and testing.
More information about the R-package-devel
mailing list