From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Sat May  9 18:47:40 2009
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Sat, 09 May 2009 18:47:40 +0200
Subject: [Rd] unsplit list of data.frames with one column
In-Reply-To: <4A05704D.7080708@biostat.ku.dk>
References: <4A044B3D.7010506@vanderbilt.edu> <4A05704D.7080708@biostat.ku.dk>
Message-ID: <4A05B3AC.8060104@idi.ntnu.no>

Peter Dalgaard wrote:
> 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]
>

looks like someone got caught by the drop=TRUE design...?

vQ



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