tlumley@u.washington.edu
2001-Dec-03 21:46 UTC
[Rd] Re: [R] appending similar data frames? (PR#1193)
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._