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

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Jun 28 23:36:50 CEST 2017


Just set
.libPaths("/tmp/current")
and then
library(devtools)
shoudl do the trick.
Best,
Uwe Ligges




On 28.06.2017 22:23, Bill Denney wrote:
> 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.
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list