[R] Error message from allEffects(model) / effect(model)" ‘range’ not meaningful for factors"

Robert Zimbardo robertzimbardo at gmail.com
Wed Aug 19 02:49:43 CEST 2015


Hi

I cannot figure out why the effects package throws me error messages
with the following simple code:


rm(list=ls(all=TRUE)); set.seed(1); library(effects)
# set up data
x <- factor(rep(letters[1:3], each=100))
y <- c(rnorm(100, 3, 3), rnorm(100, 4, 3), rnorm(100, 5, 3))


# fit linear model
m <- summary(lm(y~x)) # no problem

# now the problem
plot(allEffects(m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors
plot(effect("x", m))
# Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  :
#   ‘range’ not meaningful for factors


Any ideas? It's go to be something superobvious, but I don't get it. Thanks,
RZ



More information about the R-help mailing list