[R] Merging data.frames
Thomas Lumley
thomas at biostat.washington.edu
Wed Mar 8 17:39:29 CET 2000
On Wed, 8 Mar 2000, Richard A. Bilonick wrote:
> Unfortunately it does not help. I need to concatenate the records vertically, not
> horizontally. Each data.frame has the same variables. One data.frame may have 10
> records and the other has 20 records. I want a new data.frame with all 30 records.
> If these were matrices I would use rbind. Unfortunately rbind does not work nicely
> with data.frames.
What goes wrong with rbind? It's supposed to work on data.frames
and there's a method rbind.data.frame()
R> d<-data.frame(a=1:10,b=2:11,c=3:12)
R> e<-data.frame(a=101:110,b=102:11,c=103:112)
R> rbind(d,e)
a b c
1 1 2 3
2 2 3 4
3 3 4 5
4 4 5 6
5 5 6 7
6 6 7 8
7 7 8 9
8 8 9 10
9 9 10 11
10 10 11 12
11 101 102 103
12 102 103 104
13 103 104 105
14 104 105 106
15 105 106 107
16 106 107 108
17 107 108 109
18 108 109 110
19 109 110 111
20 110 111 112
-thomas
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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