[Rd] unsplit list of data.frames with one column

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat May 9 14:00:13 CEST 2009


Will Gray wrote:
> 
> Perhaps this is the intended behavior, but I discovered that unsplit 
> throws an error when it tries to set rownames of a variable that has no 
> dimension.  This occurs when unsplit is passed a list of data.frames 
> that have only a single column.
> 
> An example:
> 
> df <- data.frame(letters[seq(25)])
> fac <- rep(seq(5), 5)
> unsplit(split(df, fac), fac)
> 
> For reference, I'm using R version 2.9.0 (2009-04-17), subversion 
> revision 48333, on Ubuntu 8.10.
> 

That's a bug. The line

         x <- value[[1L]][rep(NA, len), ]

should be

         x <- value[[1L]][rep(NA, len), , drop=FALSE]


-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-devel mailing list