Skip to content
Prev 1723 / 12125 Next

[R-pkg-devel] Loading Libraries Outside of .lib.loc

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:
I then try to load the devtools library that I've just installed, and I 
get an error:
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:
(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.