Error in getMethod(“summary”, signature = “FitDiff”)

和自甴很熟 提交于 2020-08-09 08:46:17

问题


I am comparing lavaan objects using semTools::compareFit. It is throwing a very strange error message.

I tried also the following reproducible example:

data("HolzingerSwineford1939",package="lavaan")
HS.modelA <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9'

HS.modelB<- ' visual  =~ x1 + x2
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9'
fit.A<- cfa(HS.modelA, data = HolzingerSwineford1939)
fit.B<- cfa(HS.modelB, data = HolzingerSwineford1939)
semTools::compareFit(fit.A,fit.B)

It returns:

Error in getMethod("summary", signature = "FitDiff") : no method found for function 'summary' and signature FitDiff

Also, as the code is inside a function, but I would like to see the output printed in the screen, I also included:

result<-semTools::compareFit(fit.A,fit.B)
semTools::saveFile(result, file="",what="summary", tableFormat=FALSE)

This returns

Length Class Mode

  1 FitDiff      S4

I see the mention in the first error message something related to summary and methods... I have some S3 summary methods, trying to formalize in a package for personal use... not sure if it is related... is it possible I have messed up something? It is happening in more than one project in a RStudio installation... I have the impression it worked before...

I appreciate any help.

来源:https://stackoverflow.com/questions/63065696/error-in-getmethodsummary-signature-fitdiff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!