Possible Duplicate:
R Grouping functions: sapply vs. lapply vs. apply. vs. tapply vs. by vs. aggregate vs.
uptake  time    treatment
2.08    0   1
2.07    0   1
2.09    0   1
2.06    0   1
2.17    1   1
2.15    1   1
2.16    1   1
2.15    1   1
2.08    0   2
2.09    0   2
2.07    0   2
2.04    0   2
2.03    1   2
2.04    1   2
2.01    1   2
2.08    1   2
My data now looks like this and we want to know the mean for each treatment in different time. For example, the mean in treatment = 1 and time = 0, etc and show up on one new variable in R. Is there any convenient code in R to do this?
 
     
    