[R] Anova() in car not works after loading piecewiseSEM package
varin sacha
v@r|n@@ch@ @end|ng |rom y@hoo@|r
Sun Jul 19 08:02:40 CEST 2026
Hi,
Could this be a package compatibility bug?
Since Anova(fm2), car::Anova(fm2), and even car:::Anova.lme(fm2) all produce the same error, it doesn’t appear to be a simple namespace masking issue.
Could you post the output of:
traceback()
sessionInfo()
packageVersion("car")
packageVersion("piecewiseSEM")
packageVersion("nlme")
That should help identify the exact call that’s failing and whether the problem lies in car, piecewiseSEM, or an incompatibility between the two packages.
> Le 19 juil. 2026 à 04:58, Jinsong Zhao <jszhao using yeah.net> a écrit :
>
> I have tried each solution in a new R session, and neither works.
>
> > library(piecewiseSEM)
> Registered S3 method overwritten by 'lme4':
> method from
> na.action.merMod car
>
> This is piecewiseSEM version 2.3.0.2.
>
>
> Questions or bugs can be addressed to <jslefche using gmail.com>.
> > library(nlme)
> > library(car)
> Loading required package: carData
> > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
> > Anova(fm2)
> Error in if (random) { : the condition has length > 1
> > car::Anova(fm2)
> Error in if (random) { : the condition has length > 1
> > car:::Anova.lme(fm2)
> Error in if (random) { : the condition has length > 1
More information about the R-help
mailing list