[Rd] difference in rbind() [print?] behavior between 2.2.1 and 2.3.0

From: Roger D. Peng <rpeng_at_jhsph.edu>
Date: Thu 27 Apr 2006 - 12:58:12 GMT


I'm a little confused by a change in behavior from 2.2.1 to 2.3.0. In 2.2.1 I could do

> ## Create a list of data frames in 2.2.1
> b <- list(x = data.frame(a = 1, b = 2), y = data.frame(a = 1, b = 2))
> do.call("rbind", b)
   a b
x 1 2
y 1 2

But in 2.3.0 I get

> do.call("rbind", b)
Error in data.frame(a = c("1", "1"), b = c("2", "2"), check.names = FALSE, :

         row names contain missing values

Traceback indicates that the error is actually in the print method.

> d <- do.call("rbind", b)
> d
Error in data.frame(a = c("1", "1"), b = c("2", "2"), check.names = FALSE, :

         row names contain missing values

But:

> d[1:2, ]

     a b
NA 1 2
NA1 1 2
>

I'm not sure those are the intended row names but I'm not sure. The following does seem to work as I would have expected:

> b <- list(x = data.frame(a = 1:2, b = 2:3), y = data.frame(a = 1:2, b = 2:3))
> do.call("rbind", b)

     a b

x.1 1 2
x.2 2 3
y.1 1 2
y.2 2 3

>

-roger

-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Apr 28 00:07:10 2006

This archive was generated by hypermail 2.1.8 : Fri 28 Apr 2006 - 10:17:44 GMT