From lhansen at blackmesacapital.com  Tue Nov 25 23:30:23 2008
From: lhansen at blackmesacapital.com (lhansen at blackmesacapital.com)
Date: Tue, 25 Nov 2008 23:30:23 +0100 (CET)
Subject: [Rd] Problem with installed.packages (PR#13332)
Message-ID: <20081125223023.6E418282EFC2@mail.pubhealth.ku.dk>

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



[Rd] Problem with installed.packages (PR#13332)
lhansen at blackmesacapital.com