lhansen at blackmesacapital.com
2008-Nov-25 22:30 UTC
[Rd] Problem with installed.packages (PR#13332)
Full_Name: Lars Hansen Version: 2.8.0 OS: Linux Submission from: (NULL) (70.90.201.133) Hi, Calling installed.packages() on a directory with only one package causes an error if the priority argument is set to "NA":> installed.packages(lib.loc = "/home/lhansen/R/libs", priority = "NA")Error in mat[, "Package"] : incorrect number of dimensions This seems like a classic dropping from matrix to vector bug. Maybe the code should be mat[, "Package", drop=FALSE]. It works fine with other arguments:> installed.packages(lib.loc = "/home/lhansen/R/libs", priority = NULL)Package LibPath Version Priority Bundle Contains Depends test "test" "/home/lhansen/R/libs" "1.0-0" NA NA NA NA Imports Suggests OS_type Built test NA NA NA "2.8.0" and:> installed.packages(lib.loc = "/home/lhansen/R/libs", priority = "high")Package LibPath Version Priority Bundle Contains Depends Imports Suggests OS_type Built The documentation clearly states that "NA" is a valid argument value. It says: To select all packages without an assigned priority use 'priority = "NA"'> sessionInfo()R version 2.8.0 (2008-10-20) x86_64-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.8.0 I ran R with --vanilla. Thanks, Lars
maechler at stat.math.ethz.ch
2008-Nov-27 11:20 UTC
[Rd] Problem with installed.packages (PR#13332)
>>>>> "LH" == lhansen <lhansen at blackmesacapital.com> >>>>> on Tue, 25 Nov 2008 23:30:23 +0100 (CET) writes:LH> Full_Name: Lars Hansen LH> Version: 2.8.0 LH> OS: Linux LH> Submission from: (NULL) (70.90.201.133) LH> Hi, LH> Calling installed.packages() on a directory with only one package causes an LH> error if the priority argument is set to "NA": >> installed.packages(lib.loc = "/home/lhansen/R/libs", priority = "NA") LH> Error in mat[, "Package"] : incorrect number of dimensions LH> This seems like a classic dropping from matrix to vector bug. Yes, indeed, it is : forgetting to use ', drop = FALSE' LH> Maybe the code LH> should be mat[, "Package", drop=FALSE]. no, it's here : mat <- mat[keep, , drop=FALSE] This will be fixed in R-devel and R-patched within the next few hours. Thank you very much, Lars, for the bug report! Martin Maechler, ETH Zurich