[R] re form data for aov()?
Dan Kelley
kelley.dan at gmail.com
Sun Mar 29 17:50:40 CEST 2009
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)
but this fails. Do I need to break d$Method up into columns for each
category, with boolean entries? Or is there a way to do this more cleanly?
Data file (hands.dat)
============
Bacterial.Counts Method
74 Water
84 Soap
70 Antibacterial.Soap
51 Alcohol.Spray
135 Water
51 Soap
164 Antibacterial.Soap
5 Alcohol.Spray
102 Water
110 Soap
88 Antibacterial.Soap
19 Alcohol.Spray
124 Water
67 Soap
111 Antibacterial.Soap
18 Alcohol.Spray
105 Water
119 Soap
73 Antibacterial.Soap
58 Alcohol.Spray
139 Water
108 Soap
119 Antibacterial.Soap
50 Alcohol.Spray
170 Water
207 Soap
20 Antibacterial.Soap
82 Alcohol.Spray
87 Water
102 Soap
95 Antibacterial.Soap
17 Alcohol.Spray
--
View this message in context: http://www.nabble.com/reform-data-for-aov%28%29--tp22769061p22769061.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list