[R] Question about factor that is numeric, in aov()

Ravi Kulkarni ravi.kulk at gmail.com
Sun May 9 14:36:18 CEST 2010


I notice something curious about how aov() treats a numeric factor:

"score" is a dependent variable and "group" is a factor in a one-way ANOVA.
But "group" contains numeric codes and is not a factor (checked with
is.factor). An ANOVA done using:

> aov(score~factor(group), data=mydata)

gives the right answers. But

> aov(score~group, data=mydata)

also produces an ANOVA table, with incorrect entries. My question is: what
exactly is R doing when I did not specify that "group" was a factor?

Ravi Kulkarni
-- 
View this message in context: http://r.789695.n4.nabble.com/Question-about-factor-that-is-numeric-in-aov-tp2164393p2164393.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list