From 1f545af7183b86cd764a4fcd68dd6b4c40d4efcc Mon Sep 17 00:00:00 2001 From: maltelueken Date: Wed, 8 Nov 2023 15:01:17 +0100 Subject: [PATCH] Fix model summary footnotes --- R/classicProcess.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/R/classicProcess.R b/R/classicProcess.R index d7e249c..c035b52 100644 --- a/R/classicProcess.R +++ b/R/classicProcess.R @@ -1300,12 +1300,6 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) { # Remove invalid models procResults <- .procFilterFittedModels(procResults) - converged <- sapply(procResults, function(mod) mod@Fit@converged) - - if (!all(converged)) { - summaryTable$addFootnote(message = gettext("At least one model did not converge.")) - } - modelNames <- sapply(options[["processModels"]], function(mod) mod[["name"]]) modelNumbers <- lapply(options[["processModels"]], function(mod) { @@ -1319,6 +1313,12 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) { summaryTable[["Model"]] <- modelNames[!modelNumberIsInvalid] summaryTable[["modelNumber"]] <- modelNumbers[!modelNumberIsInvalid] + converged <- sapply(procResults, function(mod) mod@Fit@converged) + + if (any(!converged)) { + summaryTable$addFootnote(message = gettextf("The following models did not converge: %s.", modelNames[!modelNumberIsInvalid & !converged])) + } + if (length(procResults) == 0) return() aic <- sapply(procResults, AIC) @@ -1339,7 +1339,7 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) { } if (any(df == 0)) { - summaryTable$addFootnote(message = gettext("At least one model is saturated (df = 0).")) + summaryTable$addFootnote(message = gettextf("The following models are saturated (df = 0): %s.", modelNames[!modelNumberIsInvalid & df == 0])) } if (options$estimator %in% c("dwls", "gls", "wls", "uls")) {