Re: [R] how to merge several data sets?

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sun 28 Aug 2005 - 05:17:12 EST

Cunningham Kerry <kerryrekky@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@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Aug 28 05:29:01 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:01:04 EST