diff --git a/DESCRIPTION b/DESCRIPTION index ca8c36a2..6420507e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: report Type: Package Title: Automated Reporting of Results and Statistical Models -Version: 0.6.3.1 +Version: 0.6.3.2 Authors@R: c(person(given = "Dominique", family = "Makowski", diff --git a/NEWS.md b/NEWS.md index 5a417704..cc424889 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ Bug fixes +* `report.anova()`: fix missing denominator degrees of freedom in lmerTest ANOVA reports (#453) * Fix `report()` crash when character vector has only one unique value (#578). # report 0.6.3 diff --git a/R/report.aov.R b/R/report.aov.R index e784b78a..3faf0868 100644 --- a/R/report.aov.R +++ b/R/report.aov.R @@ -237,6 +237,12 @@ report_statistics.aov <- function(x, table = NULL, ...) { ", ", insight::format_value(parameters$DoF_Residuals, protect_integers = TRUE) ) + } else if ("df_error" %in% names(parameters)) { + result_text <- paste0( + result_text, + ", ", + insight::format_value(parameters$df_error, protect_integers = TRUE) + ) } # Indices diff --git a/tests/testthat/test-report.lmer.R b/tests/testthat/test-report.lmer.R index 77b6eb3c..b094a79f 100644 --- a/tests/testthat/test-report.lmer.R +++ b/tests/testthat/test-report.lmer.R @@ -25,3 +25,19 @@ test_that("report-lmer", { expect_snapshot(variant = "windows", report(m2)) }) + +test_that("report-lmerTest-anova includes denominator df", { + skip_if_not_installed("lmerTest") + + # Test case for issue #453: lmerTest ANOVA should include denominator degrees of freedom + m <- lmerTest::lmer(mpg ~ wt + (1 | gear), data = mtcars) + anova_result <- anova(m) + report_output <- report(anova_result) + + # The report should include denominator df in F-statistic + # Should be F(1, 21.92) not just F(1) + expect_match(as.character(report_output), "F\\(1, [0-9.]+\\)") + + # Should not have the old pattern without denominator df + expect_no_match(as.character(report_output), "F\\(1\\) =") +})