lm formula: the difference between `as.factor()` and `as.as.character()`
I was wondering why factor(gpid)
doesn't work like as.character(gpid)
in my manova()
call below?
data <- read.csv("https://raw.githubusercontent.com/rnorouzian/v/main/df.csv")
# gpid anx socskls assert
#1 1 5 3 3
#2 1 5 4 3
#3 1 4 5 4
summary(manova(cbind(anx,socskls,assert) ~ factor(gpid), data = data))
# Df Pillai approx F num Df den Df Pr(>F)
#gpid 1 0.073734 0.7695 3 29 0.5205
But when I change gpid
to character the output is what it should be:
summary(manova(cbind(anx,socskls,assert) ~ as.character(gpid), data = data))
# Df Pillai approx F num Df den Df Pr(>F)
# as.character(gpid) 2 0.62209 4.3642 6 58 0.001058 **
from Recent Questions - Stack Overflow https://ift.tt/3b2X8hP
https://ift.tt/eA8V8J
Comments
Post a Comment