From p.dalgaard at biostat.ku.dk  Tue Apr 29 01:47:27 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Tue Apr 29 00:44:42 2003
Subject: [Rd] installed.packages() with no packages
In-Reply-To: <Pine.SOL.4.20.0304281233530.13849-100000@santiam.dfci.harvard.edu>
References: <Pine.SOL.4.20.0304281233530.13849-100000@santiam.dfci.harvard.edu>
Message-ID: <x2llxuqlxc.fsf@biostat.ku.dk>

Jeff Gentry <jgentry@jimmy.harvard.edu> writes:

> Hello ...
> 
> I found this due to a situation where installed.packages() was given a
> lib.loc argument that turned out to not have any R packages installed.  As
> an example:
> > z <- tempfile()
> > dir.create(z)
> > installed.packages(z)
> Error in "colnames<-"(*tmp*, value = c("Package", "LibPath", pkgFlds)) : 
> 	dimnames applied to non-array
> 
> Looking at the code, it seems what happens is that 'retval' is assigned
> character() but then after the for loop the function checks 'retval' with
> a "if(!is.null(retval))", and I don't see how 'retval' could ever have a
> NULL value in this situation.  Would this be better to check against
> "nrow(retval)"?

Or change the initialization to retval <- NULL as would seem to have
been intended? Seems to work OK.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] installed.packages() with no packages
Peter Dalgaard BSA