how to merge several data sets?
Cunningham Kerry <kerryrekky at yahoo.com> writes:
Dear R-helpers, I want to merge several data sets into one single data set. For example, there are three separate data sets like:
....
There is also one difficulty that the order of id may be different for the three sets and the order ot time may be different for Set 2 and Set 3. Is there a convenient function in R to perform this operation? Thank you for your attention.
How about this?
merge(merge(d1,d2),d3)
id time age gender x1 x2 1 1 1 12 M 0.25 0.34 2 1 2 12 M 0.27 0.55 3 1 3 12 M 0.29 0.79 4 3 1 15 F 0.15 0.12 5 3 2 15 F 0.18 0.23 6 4 2 19 M 0.22 0.45 7 4 3 19 M 0.54 0.56
O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907