[R] anova on data means
Thomas Miller
miller at cbl.umces.edu
Thu Jun 21 21:56:09 CEST 2007
I am transitioning from SAS to R and am struggling with a relatively simple
analysis. Have tried Venables and Ripley and other guides but can't find a
solution.
I have an experiment with 12 tanks. Each tank holds 10 fish. The 12 tanks
have randomly assigned one of 4 food treatments - S(tarve), L(ow), M(edium)
and H(igh). There are 3 reps of each treatment. I collect data on size of
each fish at the end of the experiment. So my data looks like
Tank Trt Fish Size
1 S 1 3.4
1 S 2 3.6
....
1 S 10 3.5
2 L 1 3.4
....
12 M 10 2.1
To do the correct test of hypothesis using anova, I need to calculate the
tank means and use those in the anova. I have tried using tapply() and by()
functions, but when I do so I "loose" the treatment level because it is
categorical. I have used
Meandat<tapply(Size,list(Tank, Trt), mean)
But that doesn't give me a dataframe that I can then use to do the actual
aov analysis. So what is the most efficient way to accomplish the analysis
Thanks
Tom Miller
More information about the R-help
mailing list