Re: [R] library(...,pos=) is not consistent

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu, 17 Jun 2010 13:33:38 -0400

On Thu, Jun 17, 2010 at 1:28 PM, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:
> On Thu, Jun 17, 2010 at 1:11 PM, Russell Ivory
> <Russell.Ivory_at_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_at_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. Received on Thu 17 Jun 2010 - 17:42:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jun 2010 - 18:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive