[R] Merge question

Vadlamani, Subrahmanyam {FLNA} subrahmanyam.vadlamani at fritolay.com
Thu Feb 26 18:52:16 CET 2009


Hi:
I am a new R user. I have the following question and would appreciate your input

Data1 (data frame 1)
p1,d1,d2 (p1 is text and d1 and d2 are numeric)
xyz,10,25

Data2 (data frame 2)
p1,d1,d2
xyz,11,15

Now I want to create a new data frame that looks like so below. The fields d1 and s2 are summed by the product key.
Data3
p1,d1,d2
xyz,21 (sum of 10 from Data1 and 11 from Data2),40 (sum of 25 from Data1 and 15 from Data2)

Any other examples of merge you may have will be appreciated. Thanks.
Satish




More information about the R-help mailing list