[R] rbind and data.frame

Göran Broström gb at stat.umu.se
Wed Dec 5 10:37:33 CET 2001


Version 1.3.1  (2001-08-31) (RH 7.2):

> dat <- data.frame(x = 1, y = 2)
> x <- matrix(0, ncol = 2, nrow = 2)
> x
     [,1] [,2]
[1,]    0    0
[2,]    0    0
> dat
  x y
1 1 2
> rbind(dat, x)
  x y
1 1 2
2 0 0

I expected

> rbind(dat, x)
  x y
1 1 2
2 0 0
3 0 0

Is my expectation wrong?

Göran Broström

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list