Re: Anova() in car not works after loading piecewiseSEM package
varin sacha via R-help <[email protected]> Sun, 19 Jul 2026 08:02:40 +0200
| Newsgroups | gmane.comp.lang.r.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Could this be a package compatibility bug?
Since Anova(fm2), car::Anova(fm2), and even car:::Anova.lme(fm2) all produc=
e the same error, it doesn=E2=80=99t appear to be a simple namespace maskin=
g issue.
Could you post the output of:
traceback()
sessionInfo()
packageVersion("car")
packageVersion("piecewiseSEM")
packageVersion("nlme")
That should help identify the exact call that=E2=80=99s failing and whether=
the problem lies in car, piecewiseSEM, or an incompatibility between the t=
wo packages.
> Le 19 juil. 2026 =C3=A0 04:58, Jinsong Zhao <[email protected]> a =C3=A9cri=
t :
> =
> 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 <[email protected]>.
> > library(nlme)
> > library(car)
> Loading required package: carData
> > fm2 <- lme(distance ~ age + Sex, data =3D Orthodont, random =3D ~ 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