[Rd] Re: [R] appending similar data frames? (PR#1193)

tlumley@u.washington.edu tlumley@u.washington.edu
Mon, 3 Dec 2001 22:46:45 +0100 (MET)


On Mon, 3 Dec 2001, Duncan Murdoch wrote:

> As long as the names match exactly in the two original frames, you
> should be able to do it using "rbind" and "cbind":
>
> Specifically:
>
>  rbind( cbind(x, 'x'), cbind(y, 'y') )
>


I would have thought that the recycling rules allowed this, but it doesn't
work and you need cbind(x, rep('x', NROW(x))) instead.

The documentation only specifically addresses vectors and matrices but
says
     When the arguments consist of a mix of matrices and vectors the
     number of columns (rows) of the result is determined by the number
     of columns (rows) of the matrix arguments.  Any vectors have their
     values recycled or subsetted to achieve this length.

I think it's a bug, but it might just be a documentation bug.


	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._