ANOVA error on R

user3403745 picture user3403745 · Aug 20, 2015 · Viewed 13.8k times · Source

I get this error when I run an ANOVA on R:

Warning messages:
1: In model.response(mf, "numeric") :
   using type = "numeric" with a factor response will be ignored
2: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors

I don't really understand what this means and haven't really found any explanation online for it. Here's what my ANOVA is:

fit <- aov(PC1 ~ Type, data=dffinalSep)

And here's the str() for my data frame:

'data.frame':   44 obs. of  4 variables:
 $ Name: Factor w/ 22 levels "REVICF1","REVICF4",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ Type: Factor w/ 2 levels "N","S": 1 1 1 1 1 1 1 1 1 1 ...
 $ PC1 : Factor w/ 44 levels "-11.230081419753",..: 31 44 36 35 27 2 17 16 32 38 ...
 $ PC2 : Factor w/ 44 levels "-110.874127803912",..: 1 12 25 29 8 13 42 43 22 26 ...

I'm not really sure what I'm doing wrong. The data frame contains two variables from a PCA using prcomp and then the Type variable which contains two different values (N and S). Any help would be appreciated.

Thanks!

Answer