[R] how to merge several data sets?

From: Cunningham Kerry <kerryrekky_at_yahoo.com>
Date: Sun 28 Aug 2005 - 03:31:22 EST


Dear R-helpers,
  I want to merge several data sets into one single data set. For example, there are three separate data sets like:  

Set 1:  

id age gender
01 12 M
03 15 F
04 19 M
...
 

Set 2:  

id time x1

01 1 0.25
01 2 0.27
01 3 0.29
03 1 0.15
03 2 0.18
04 2 0.22
04 3 0.54

...
 

Set 3:  

id time x2

01 1 0.34
01 2 0.55
01 3 0.79
03 1 0.12
03 2 0.23
04 2 0.45
04 3 0.56

......
 

I want to merge the three sets into one new set as below:  

id age gender time x1 x2

01 12 M 1 0.25 0.34
01 12 M 2 0.27 0.55
01 12 M 3 0.29 0.79
03 15 F 1 0.15 0.12

.......
 

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.


        [[alternative HTML version deleted]]



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 03:40:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:57 EST