[R] Problem with update.packages on repo with a single package

Michael DiPersio mdipersio at prilink.com
Wed May 6 06:03:02 CEST 2009


I've set up a CRAN-style repository to distribute a single package.  The 
repository contains several versions of the package, I was hoping that 
update.packages pointed at this repository would grab the highest 
version number.  In fact it returns an error:

Error in available[, "Bundle"] : incorrect number of dimensions

This is because the private function .remove_stale_dups in utils, which 
is supposed to return a copy of an available.packages matrix with no 
duplicates, does not return a matrix in the case where all available 
packages are stale except one.  To fix this I've made the following 
simple change to the utils package in my copy of R, but if I've 
overlooked something I'd be happy to hear about it:

Index: packages.R
===================================================================
--- packages.R    (revision 48465)
+++ packages.R    (working copy)
@@ -869,5 +869,5 @@
         stale_dups[i:end_i] <- wh
         i <- end_i + 1L
     }
-    if(length(stale_dups)) ap[-stale_dups, ] else ap
+    if(length(stale_dups)) ap[-stale_dups,,drop=FALSE ] else ap
 }

Thanks,

Michael DiPersio




More information about the R-help mailing list