[R] group by in data.frame

zem zmanolova at gmail.com
Fri Feb 25 12:11:13 CET 2011


Hi all,

i have a little problem, and i think it is really simple to solve, but i
dont know exactly how to.
here is the "challange": 
i have a data.frame with n colum, i have to group 2 of them and calculate
the mean value of the 3. one. so far so good, that was easy - i used
aggregate function to do this:
group<-aggregate(x[,1],list(x[,2],x[,3]),mean) 
and now i have to copy the calculated mean value to every row of the
date.frame (in a new column in the dataframe), ofcourse by copying should be
the value  adequate to the group

it will be great if someone can help me
thanx in advance! 
-- 
View this message in context: http://r.789695.n4.nabble.com/group-by-in-data-frame-tp3324240p3324240.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list