[R] how calculate mean for each group

szhan@uoguelph.ca szhan at uoguelph.ca
Thu Oct 2 03:15:11 CEST 2003


Hello, R experts:
I got data like this:
group   duplicate   treatment 
A         Y          5
A         Y          3
A         N          6
B         Y          2
B         N          4
B         Y          1
How to sort the data and calculate the average treatment value for each group 
in two level of duplicate. Results like this:
group   duplicate   treatment 
A         Y          4
A         N          6
B         Y          1.5
B         N          4
Thank you in advance.

Josh




More information about the R-help mailing list