//One-Way ANOVA Example //Created by John M. Quick //http://www.johnmquick.com //October 11, 2010 > #read the one-way ANOVA dataset into an R variable using the read.csv(file) function > dataOneWay <- read.csv("dataset_ANOVA_OneWay.csv") > #display the data > dataOneWay Group Values 1 control 1 2 control 2 3 control 3 4 control 3 5 control 3 6 control 1 7 control 1 8 control 2 9 control 1 10 control 1 11 control 3 12 control 1 13 control 1 14 control 4 15 control 1 16 control 1 17 control 5 18 control 2 19 control 2 20 control 3 21 control 4 22 control 1 23 control 1 24 control 3 25 control 2 26 control 2 27 control 2 28 control 1 29 control 2 30 control 1 31 treatment 3 32 treatment 3 33 treatment 3 34 treatment 4 35 treatment 5 36 treatment 3 37 treatment 5 38 treatment 5 39 treatment 5 40 treatment 3 41 treatment 4 42 treatment 4 43 treatment 4 44 treatment 3 45 treatment 3 46 treatment 5 47 treatment 4 48 treatment 4 49 treatment 4 50 treatment 4 51 treatment 4 52 treatment 4 53 treatment 3 54 treatment 3 55 treatment 5 56 treatment 5 57 treatment 5 58 treatment 5 59 treatment 4 60 treatment 4 > #use anova(object) to test the omnibus hypothesis in one-way ANOVA > #is the difference between the group means statistically significant? > anova(lm(Values ~ Group, dataOneWay)) Analysis of Variance Table Response: Values Df Sum Sq Mean Sq F value Pr(>F) Group 1 60 60.000 64.444 5.503e-11 *** Residuals 58 54 0.931 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1