Hello,
a have two matrices of data as below. I would like to add-up the duplicate
in terms of pair of names in rows, and then merge the values in the second
matrix to the pairs as two new variables x3 and x4.
Input
,x1,x2
jane.mike,31,43
jane.steve,32,2
jane.steve,5,3
jim.mike,76,5
jane.steve,4,4
mike.steve,54,7
mike.steve,5,7
jane.mike,7,8
and
,y
jane,0.3
jim,0.4
mike,0.1
carl,0.5
john,0.9
steve,0.4
dirk,0.2
Output:
,x1,x2,x3,x4
jane.mike,38,51,0.3,0.1
jane.steve,41,9,0.3,0.4
jim.mike,76,5,0.4,0.1
mike.steve,59,14,0.1,0.4
Any help appreciated,
Serguei
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.