[Rd] rbind.data.frame changes

Mark.Bravington at csiro.au Mark.Bravington at csiro.au
Thu Jun 28 01:27:22 CEST 2007

Dear R-devel

Pre-2.5.0, 'rbind.data.frame(x,y,...)' would set the class of each
column to be the class of that column in 'x'. This has changed now,
because 'rbind.data.frame' first deletes any zero-row arguments; so if
'x' is a zero-row DF, the classes will be set to those in 'y'.

This breaks my code in a number of places, where I've created 0*N
data.frames with the correct column classes, and then subsequently added
rows, typically via 'rbind( my.df, list( col1=...))'. Typically the
issue is with unwanted conversion of characters into factors, and I've
set up the zero-row DF specifically to avoid that.

My understanding of the motivation for the change is that there were
problems with 0*0 data.frames only. But 0*(N>0) data.frames where N>0
were handled OK, I think. It therefore seems to me that the new
behaviour is undesirable for 0*(N>0), in that they are treated
differently to (M>0)*(N>0) data.frames for no very compelling reason. 

Before I go through all the code in 'mvbutils' and 'debug' to work round
this, I wanted to make sure that the change really is intentional and
"permanent". Can anyone confirm/deny this?


Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

More information about the R-devel mailing list