On Thu, Jun 17, 2010 at 1:28 PM, Gabor Grothendieck <ggrothendi...@gmail.com> wrote: > On Thu, Jun 17, 2010 at 1:11 PM, Russell Ivory > <russell.iv...@merrickbank.com> wrote: >> I want to be able to load a library in a specified position using the >> pos= argument and have any subsequent library required by the one I'm >> loading go into a specified library as well. For example, in loading >> caret, it requires and loads lattice as well. When I specify that caret >> goes into position 9, lattice goes into position 2 by default. Is there >> a way to specify that by loading a library into position n, any >> subsequent library goes into, say, n+1 and so on? I need to reserve >> position 2. >> > > Its a bit tedious but if you load each dependent package prior to any > package depending on it then you can get them to go into position 9 or > higher. This must be done recursively so, for example, you need to > load plyr before reshape since caret depends on reshape which depends > on plyr. In this case it works out like this: > >> library(plyr, pos = 9) >> library(reshape, pos = 9) >> library(lattice, pos = 9) >> library(caret, pos = 9) >> search() > [1] ".GlobalEnv" "package:stats" "package:graphics" > [4] "package:grDevices" "package:utils" "package:datasets" > [7] "package:methods" "Autoloads" "package:caret" > [10] "package:lattice" "package:reshape" "package:plyr" > [13] "package:base" >
Also if would be possible to automate this by recursively following packageDescription("caret")$Depends and issuing the requisite library calls. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.