The glance.lavaan() function (in R/lavaan-tidiers.R) is accessing internal slots of a fitted lavaan object to extract some information, instead of using the extractor functions. As the internal slots will change in the next update, this breaks the glance.lavaan() function.
The urgent issue is line 136
converged = x@Fit@converged
which should be replaced by
converged = lavInspect(x, "converged")
as the 'Fit' slot is going to be removed.
But I would suggest changing the whole tibble section to this:
tibble(
converged = lavInspect(x, "converged"),
estimator = lavInspect(x, "options")$estimator,
ngroups = lavInspect(x, "ngroups"),
missing_method = lavInspect(x, "options")$missing,
nobs = sum(purrr::accumulate(lavInspect(x, "nobs"), sum)),
norig = sum(purrr::accumulate(lavInspect(x, "norig"), sum)),
nexcluded = norig - nobs
)
avoiding any access to internal slots.
Finally, I don't understand why the purrr::accumulate() function is needed. I believe that what is intended is simply:
nobs = sum(lavInspect(x, "nobs"),
norig = sum(lavInspect(x, "norig"),
nexcluded = norig - nobs
taking the sum over the (possibly multiple) groups.
Yves.
The glance.lavaan() function (in R/lavaan-tidiers.R) is accessing internal slots of a fitted lavaan object to extract some information, instead of using the extractor functions. As the internal slots will change in the next update, this breaks the glance.lavaan() function.
The urgent issue is line 136
which should be replaced by
as the 'Fit' slot is going to be removed.
But I would suggest changing the whole tibble section to this:
tibble( converged = lavInspect(x, "converged"), estimator = lavInspect(x, "options")$estimator, ngroups = lavInspect(x, "ngroups"), missing_method = lavInspect(x, "options")$missing, nobs = sum(purrr::accumulate(lavInspect(x, "nobs"), sum)), norig = sum(purrr::accumulate(lavInspect(x, "norig"), sum)), nexcluded = norig - nobs )avoiding any access to internal slots.
Finally, I don't understand why the purrr::accumulate() function is needed. I believe that what is intended is simply:
taking the sum over the (possibly multiple) groups.
Yves.