Skip to content

Commit

Permalink
Merge pull request #616 from amices/615-pool-on-lavaan-fit-objects-gi…
Browse files Browse the repository at this point in the history
…ves-error-coef-not-available-on-s4-object

Add `stats` namespace to `coef()` to fix #615
  • Loading branch information
stefvanbuuren authored Apr 17, 2024
2 parents 62adb40 + 0cd9f80 commit 73d37c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/get.df.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ get.dfcom <- function(model, dfcom = NULL) {

# coxph model: nevent - p
if (inherits(model, "coxph")) {
return(as.numeric(max(model$nevent - length(coef(model)), 1)))
return(as.numeric(max(model$nevent - length(stats::coef(model)), 1)))
}

# other model: n - p
nobs <- tryCatch(length(stats::residuals(model)),
error = function(e) NULL)
if (!is.null(nobs)) {
return(as.numeric(max(nobs - length(coef(model)), 1)))
return(as.numeric(max(nobs - length(stats::coef(model)), 1)))
}

# nothing found
Expand Down

0 comments on commit 73d37c6

Please sign in to comment.