diff --git a/R/utils_pca_efa.R b/R/utils_pca_efa.R index 0336c3de4..b8d0211fa 100644 --- a/R/utils_pca_efa.R +++ b/R/utils_pca_efa.R @@ -150,7 +150,7 @@ predict.parameters_efa <- function(object, ...) { attri <- attributes(object) - if (inherits(attri$model, c("psych", "principal"))) { + if (inherits(attri$model, c("psych", "principal", "psych", "fa"))) { if (is.null(newdata)) { if ("scores" %in% names(attri)) { out <- as.data.frame(attri$scores) @@ -167,23 +167,6 @@ predict.parameters_efa <- function(object, # psych:::predict.principal(object, data) out <- stats::predict(attri$model, data = newdata) } - } else if (inherits(attri$model, c("psych", "fa"))) { - if (is.null(newdata)) { - if ("scores" %in% names(attri)) { - out <- as.data.frame(attri$scores) - if (isTRUE(keep_na)) { - # Because pre-made scores don't preserve NA - out <- .merge_na(object, out) - } - } else { - d <- attri$data_set - d <- d[vapply(d, is.numeric, logical(1))] - out <- as.data.frame(stats::predict(attri$model, data = d)) - } - } else { - # psych:::predict.fa(object, data) - out <- as.data.frame(stats::predict(attri$model, newdata = newdata)) - } } else if (inherits(attri$model, "spca")) { # https://github.com/erichson/spca/issues/7 newdata <- newdata[names(attri$model$center)]