[Rd] library: loading of required packages and argument 'lib.loc'

Renaud Gaujoux renaud at mancala.cbio.uct.ac.za
Tue Oct 5 14:34:43 CEST 2010


is there a reason why when calling the argument 'lib.loc' of library() 
is not used when trying to load the required packages?

0. Package A depends on package B
1. Install packages A and B in a subdirectory 'lib' of the current directory
2. Call:

library(A, lib.loc='./lib')

This will give something like the following:

Loading required package: B
Error: package 'B' could not be loaded
In addition: Warning message:
In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = 
lib.loc) :
   there is no package called 'B'

In function library there the call '.getRequiredPackages2(pkgInfo)' 
loads the required packages but do not pass the argument lib.loc 
(whereas .getRequiredPackages2 has an argument for this).
I know a quick work around for this is to put './lib' into .libPaths but 
it would be nice if library() could do it locally (e.g. pass the 
argument), without changing the global settings.




This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 4500. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.


More information about the R-devel mailing list