[R] re form data for aov()?
Dieter Menne
dieter.menne at menne-biomed.de
Sun Mar 29 20:08:44 CEST 2009
Dan Kelley <kelley.dan <at> gmail.com> writes:
>
>
> I have data in a file named hands.dat, which is given at the end of this
> question. (It's from a stats textbook example on anova). I'd like to do an
> aov on this, which I guess would be
>
> d <- read.table("~/hands.dat", header=TRUE)
>
> aov(Bacterial.Counts ~ Water + Soap + Antibacterial.Soap + Alcohol.Spray,
> data=d)
>
> Data file (hands.dat)
> ============
>
> Bacterial.Counts Method
> 74 Water
> 84 Soap
> 70 Antibacterial.Soap
> 51 Alcohol.Spray
To be sure that data are ok, first try
str(d)
Method should be factor.
aov(BacterialCounts~Method,data=d)
Dieter
More information about the R-help
mailing list