[R] For the record: how to merge data frames vertically

Kaspar Pflugshaupt pflugshaupt at geobot.umnw.ethz.ch
Thu Mar 9 09:56:30 CET 2000


Hello,

to save searching time in the S-news archive, here is the simple solution to
merge data frames vertically (cols must be equivalent, of course). The
frames must be components of a list, such as produced by
framelist<-split(bigframe,factor).

bigframe2<-do.call("rbind",framelist)

# posted to S-news by Bill Venables, found in summary message
http://lib.stat.cmu.edu/s-news/Burst/13564

The result is identical to bigframe with the exception of the rownames.
Those seem to be generated by pasting the respective component name and each
rowname (maybe to prevent non-unique rownames?). To keep rownames, I use

rownames(bigframe2)<-unlist(lapply(framelist,rownames))

Now, all I wonder is, why does this solution work and "rbind(framelist)"
does not? (gives "Error in rbind(...) : cannot create a matrix from these
types"). To my untrained eye, the two look identical...

Cheers

Kaspar

-- 

Kaspar Pflugshaupt
Geobotanisches Institut
Zuerichbergstr. 38
CH-8044 Zuerich

Tel. ++41 1 632 43 19
Fax  ++41 1 632 12 15

mailto:pflugshaupt at geobot.umnw.ethz.ch
privat:pflugshaupt at mails.ch
http://www.geobot.umnw.ethz.ch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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