[R] Problem with Anova() in package "car"

John Fox jfox at mcmaster.ca
Tue Jan 13 23:06:13 CET 2015


Dear Gang,

The problem was in the model.matrix.lme() method provided by the car
package, and is now fixed in the development version of the car package on
R-Forge. You should be able to install it from there via
install.packages("car", repos="http://R-Forge.R-project.org") after the
package is next built on R-Forge, usually in a day or so.

Best,
 John

> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Gang Chen
> Sent: January-13-15 1:48 PM
> To: r-help
> Subject: [R] Problem with Anova() in package "car"
> 
> 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 at 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.


---
This email has been checked for viruses by Avast antivirus software.



More information about the R-help mailing list