I'm currently working on a project for school where I need to run a one way ANOVA on the %uninsured motorists from each state divided by region. I'm trying to remove the NA from the table, but am having trouble.
> motor
MW NE SE W
1 0.11 0.09 0.25 0.16
2 0.13 0.11 0.20 0.16
3 0.12 0.04 0.13 0.22
4 0.10 0.07 0.10 0.32
5 0.09 0.09 0.08 0.10
6 0.13 0.15 0.16 0.08
7 0.12 0.07 0.25 0.09
8 0.13 0.09 0.06 0.15
9 0.07 0.11 0.28 0.30
10 0.07 0.09 0.18 0.12
11 0.13 NA 0.12 0.09
12 0.17 NA 0.21 0.15
13 0.06 NA NA 0.07
14 0.18 NA NA NA
15 0.08 NA NA NA
16 0.11 NA NA NA
> aov(motor)
Error in terms.default(formula, "Error") :
no terms component nor attribute
I've tried using na.omit, complete.cases, and na.rm, but either parts of my data were removed or I received the same error message. I have also tried
summary(lm(motor))
This gave me a P-value of .77, which is different from the P-value I received when running the data in excel (P = 0.007859928)
I know I'm just missing something small, but have tried looking for the last two hours to find it with no avail.
Can anyone help?
Hye, your formula is not good , you need to have a column as factor (motorist for exemple) and to plot. This column is missing in your data. Supose you include this column "motorist"
motorist<-c("A","B","C","B","B","B","B","A","A","A","A","C","C","A","B","C")
motor<-cbind(motorist,motor)
aov(w~motorist,motor)
will work