From 266c947ad4482206eba2577cfbdb8996bf6d7fdb Mon Sep 17 00:00:00 2001 From: Dominique Makowski Date: Mon, 17 Jun 2024 08:23:27 +0200 Subject: [PATCH] [Fix] Fixes edgecase for predict.parameters_efa (#980) * fix edgecase in predict for fa objects * fix? --- R/utils_pca_efa.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils_pca_efa.R b/R/utils_pca_efa.R index d664e0e61..68eed7452 100644 --- a/R/utils_pca_efa.R +++ b/R/utils_pca_efa.R @@ -178,7 +178,7 @@ predict.parameters_efa <- function(object, out <- as.matrix(newdata) %*% as.matrix(attri$model$loadings) out <- stats::setNames(as.data.frame(out), paste0("Component", seq_len(ncol(out)))) } else if (inherits(attri$model, c("psych", "fa", "principal"))) { - out <- as.data.frame(stats::predict(attri$model, data = newdata, ...)) + out <- as.data.frame(stats::predict(attri$model, data = newdata[rownames(attri$model$weights)], ...)) } else { out <- as.data.frame(stats::predict(attri$model, newdata = newdata, ...)) }