Dear R users, Suppose I have the following data.frame:
myID myType myNum1 myNum2 myNum3 a Single 10 11 12 b Single 15 25 35 c Double 22 33 44 d Double 4 6 8 and I want to have new records: myID myType myNum1 myNum2 myNum3 e Single 12.5 18 23.5 f Double 13 19.5 28 where record e got its myNum1-3 as the average from record a and b, and record f got its myNum1-3 as the average from record c and d. and the final data.frame should be like the following: myID myType myNum1 myNum2 myNum3 a Single 10 11 12 b Single 15 25 35 e Single 12.5 18 43.5 c Double 22 33 44 d Double 4 6 8 f Double 13 19.5 28 Any idea is appreciated. Thanks beforehand. Ferry [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.