[R] Dep setting for install of packages...

Gabor Grothendieck ggrothendieck at gmail.com
Mon Oct 20 04:46:25 CEST 2008


leaps is not in Depends or Imports for car.  It is in Suggests
and those don't get automatically pulled in when dependencies = NA.

What you could do is to replace the builtin menuInstallPkgs with
your own by running this:

assignInNamespace("menuInstallPkgs", function (type = getOption("pkgType")) {
    install.packages(NULL, .libPaths()[1], dependencies = TRUE, type = type)
}, ns = "utils")

You will need to do that in every session that you want to use the install
menu or you could just add it to your Rprofile.site file which you
can find by running this:

file.path(R.home(), "etc", "Rprofile.site")


On Sun, Oct 19, 2008 at 10:09 PM, Brian Lunergan <ff809 at ncf.ca> wrote:
> Gabor Grothendieck wrote:
>>
>> Its showing you the install.packages command that
>> the menu invokes.  You can keep pressing Enter
>> to step through that and you can try entering the
>> same command from your R console to verify its
>> operation.
>
> Tried an install of car three different times. Once from the menu (with the
> debug function active as you described earlier) and two variations of manual
> entry of the install.packages() command. Only one that pulled in the
> dependencies was the third where dep = TRUE was explicitly included. The
> session print follows. Back to my original question. Since it is obviously
> turned off and non-functional in the menu code, is there a modification I
> can make to turn it back on without recompiling the whole package??
>
>> utils:::menuInstallPkgs()
> debugging in: utils:::menuInstallPkgs()
> debug: {
>    install.packages(NULL, .libPaths()[1], dependencies = NA,
>        type = type)
> }
> Browse[1]>
> debug: install.packages(NULL, .libPaths()[1], dependencies = NA, type =
> type)
> Browse[1]>
> trying URL
> 'http://probability.ca/cran/bin/windows/contrib/2.7/car_1.2-8.zip'
> Content type 'application/zip' length 714888 bytes (698 Kb)
> opened URL
> downloaded 698 Kb
>
> package 'car' successfully unpacked and MD5 sums checked
>
> The downloaded packages are in
>        c:\temp\RtmpCbKGWy\downloaded_packages
> updating HTML package descriptions
> exiting from: utils:::menuInstallPkgs()
> NULL
>> install.packages(NULL, .libPaths()[1], dependencies = NA)
> trying URL
> 'http://probability.ca/cran/bin/windows/contrib/2.7/car_1.2-8.zip'
> Content type 'application/zip' length 714888 bytes (698 Kb)
> opened URL
> downloaded 698 Kb
>
> package 'car' successfully unpacked and MD5 sums checked
>
> The downloaded packages are in
>        c:\temp\RtmpCbKGWy\downloaded_packages
> updating HTML package descriptions
>> install.packages(NULL, .libPaths()[1], dependencies = TRUE)
> also installing the dependency 'leaps'
>
> trying URL
> 'http://probability.ca/cran/bin/windows/contrib/2.7/leaps_2.7.zip'
> Content type 'application/zip' length 116782 bytes (114 Kb)
> opened URL
> downloaded 114 Kb
>
> trying URL
> 'http://probability.ca/cran/bin/windows/contrib/2.7/car_1.2-8.zip'
> Content type 'application/zip' length 714888 bytes (698 Kb)
> opened URL
> downloaded 698 Kb
>
> package 'leaps' successfully unpacked and MD5 sums checked
> package 'car' successfully unpacked and MD5 sums checked
>
> The downloaded packages are in
>        c:\temp\RtmpCbKGWy\downloaded_packages
> updating HTML package descriptions
>>
>
>
>>
>> On Sun, Oct 19, 2008 at 10:09 AM, Brian Lunergan <ff809 at ncf.ca> wrote:
>>>
>>> Gabor Grothendieck wrote:
>>>>
>>>> Your .libPaths() has a single component.  The number
>>>> of characters in it is not relevant so it should be bringing
>>>> in the dependenies.  Suggest you try this:
>>>>
>>>> debug(utils:::menuInstallPkgs)
>>>>
>>>> and try using the menu now and see what
>>>> comes up.
>>>> chooseCRANmirror()
>>>> debug(utils:::menuInstallPkgs)
>>>> utils:::menuInstallPkgs()
>>>
>>> debugging in: utils:::menuInstallPkgs()
>>> debug: {
>>>   install.packages(NULL, .libPaths()[1], dependencies = NA,
>>>       type = type)
>>> }
>>> Browse[1]>
>>>
>>> Cursor waiting quietly at that prompt, but nothing else happened after
>>> entering the debug command and clicking the menu option.
>>>
>>> Keep in mind I am not a programmer and this sort of deep dive into the
>>> inner
>>> workings of a software tool I make use of is way outside my range of
>>> experience.
>>>
>>> Was there a next step I should have made, or is this what was supposed to
>>> happen? No list of packages appeared. The program simply paused waiting
>>> for
>>> something else to be done by the human looking at the screen.
>>>
>>>> On Sat, Oct 18, 2008 at 9:37 PM, Brian Lunergan <ff809 at ncf.ca> wrote:
>>>>>
>>>>> Gabor Grothendieck wrote:
>>>>>>
>>>>>> dependencies = NA is only identical to dependencies = FALSE if
>>>>>>  .libPaths()
>>>>>> has multiple components.  If it has a single component then its the
>>>>>> same as dependencies = c("Depends", "Imports").   Read the
>>>>>> dependencies= entry on the ?install.packages page.  Also read
>>>>>> ?.libPaths
>>>>>
>>>>> Ok, ran .libPaths() and got:
>>>>>
>>>>>> .libPaths()
>>>>>
>>>>> [1] "C:/R-2.7.0/library"
>>>>> That, as I understand the notes, is a valid path entry of > 1
>>>>> character.
>>>>> What am I missing about this? I already know, using the
>>>>> install.packages
>>>>> example below, that explicitly stating dep = TRUE sends R off on a hunt
>>>>> for
>>>>> the dependencies of a particular package during installation. What I
>>>>> would
>>>>> like to know and understand is whether that is the only way to do so
>>>>> since
>>>>> dep = TRUE has been turned off for the Install package(s) menu option
>>>>> or
>>>>> is
>>>>> there a 'tweak' of the menu possible to turn the ability back on
>>>>> without
>>>>> having to recompile the whole blessed program??
>>>>>
>>>>>
>>>>>> On Sat, Oct 18, 2008 at 8:30 PM, Brian Lunergan <ff809 at ncf.ca> wrote:
>>>>>>>
>>>>>>> Evening again folks:
>>>>>>>
>>>>>>> Bear with me while crow is consumed. I had asserted that 2.7.2 had
>>>>>>> dep
>>>>>>> =
>>>>>>> NA
>>>>>>> while prior installations had it turned on. Incorrect on my part.
>>>>>>> Dumped
>>>>>>> that version and stepped back two iterations to 2.7.0. Tried it with
>>>>>>> that
>>>>>>> one and the setting is indeed off for installing by menu. My
>>>>>>> apologies
>>>>>>> for
>>>>>>> the lack of information in my original post and for what has clearly
>>>>>>> turned
>>>>>>> out to be a misconception on my part.
>>>>>>>
>>>>>>> My question now... Is there a modification I can make to turn dep
>>>>>>> back
>>>>>>> on
>>>>>>> when using the menu without recompiling, or is install.packages() the
>>>>>>> only
>>>>>>> way to install and have the program chase the needed dependencies for
>>>>>>> a
>>>>>>> package?
>>>>>>>
>>>>>>> BTW, here is a more detailed look at the current run with 2.7.0.
>>>>>>>
>>>>>>> R version 2.7.0 (2008-04-22)
>>>>>>> i386-pc-mingw32
>>>>>>>
>>>>>>> locale:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252
>>>>>>>
>>>>>>> attached base packages:
>>>>>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>>>>>
>>>>>>> loaded via a namespace (and not attached):
>>>>>>> [1] tools_2.7.0
>>>>>>>
>>>>>>> OS is Windows XP SP2
>>>>>>>
>>>>>>> Chose Ontario, Canada using Packages>Set CRAN mirror
>>>>>>>
>>>>>>> Chose ctv using Packages>Install package(s). ctv was all that was
>>>>>>> pulled
>>>>>>> in.
>>>>>>>
>>>>>>> Retried using install.packages("ctv", dep = TRUE) at the prompt and
>>>>>>> pulled
>>>>>>> in XML and ctv.
>
>
> --
>
> Brian Lunergan
> Nepean, Ontario
> Canada
>
>
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 081018-0, 2008-10-18
> Tested on: 2008-10-19 22:09:12
> avast! - copyright (c) 1988-2008 ALWIL Software.
> http://www.avast.com
>
>
>
>



More information about the R-help mailing list