I'm having some trouble with Anova() in package "car". When the model
formula is explicitly expressed:

library('nlme')
library('car')
fm <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)

Anova() works fine:

Anova(fm)

However, if the model formula is scanned from an external source:

myModel <- as.formula("distance ~ age + Sex")
fm2 <- lme(myModel, data = Orthodont, random = ~ 1)

I get the following error:

Anova(fm2)
Error: object of type 'symbol' is not subsettable

How to resolve the situation when the model formula is defined externally?

Thanks,
Gang

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to