Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: report
Type: Package
Title: Automated Reporting of Results and Statistical Models
Version: 0.6.1.2
Version: 0.6.1.3
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Bug fixes

* Fixed custom effect size rules not being correctly reported as custom rules (#458)
* Fixed issue with missing effect size for the Intercept term in type 3 anova tables (#451)

# report 0.6.1
Expand Down
7 changes: 6 additions & 1 deletion R/report_effectsize.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ print.report_effectsize <- function(x, ...) {
field2013 = "Field's (2013)",
landis1977 = "Landis' (1977)"
)
text <- paste0("Effect sizes were labelled following ", effsize_name, " recommendations.")
# If effsize_name is NULL, it means we have a custom rule name
if (is.null(effsize_name)) {
text <- paste0("Effect sizes were labelled following a custom set of rules.")
} else {
text <- paste0("Effect sizes were labelled following ", effsize_name, " recommendations.")
}
} else {
text <- paste0("Effect sizes were labelled following a custom set of rules.")
}
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-report.htest-t-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,15 @@ test_that("report.htest-t-test", {
variant = "windows",
report_effectsize(x, rules = "gignac2016", type = "g")
)

# custom rules ---------------------
custom_rules <- effectsize::rules(1, c("tiny", "yeah okay"), name = "Unknown")
expect_snapshot(
variant = "windows",
report_effectsize(x, rules = custom_rules)
)
expect_snapshot(
variant = "windows",
report(x, rules = custom_rules)
)
})
66 changes: 66 additions & 0 deletions tests/testthat/test-text_effectsize.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
test_that(".text_effectsize handles custom rules correctly", {
# Test NULL input
expect_equal(report:::.text_effectsize(NULL), "")

# Test known predefined rules
expect_equal(
report:::.text_effectsize("cohen1988"),
"Effect sizes were labelled following Cohen's (1988) recommendations."
)
expect_equal(
report:::.text_effectsize("sawilowsky2009"),
"Effect sizes were labelled following Savilowsky's (2009) recommendations."
)
expect_equal(
report:::.text_effectsize("gignac2016"),
"Effect sizes were labelled following Gignac's (2016) recommendations."
)
expect_equal(
report:::.text_effectsize("funder2019"),
"Effect sizes were labelled following Funder's (2019) recommendations."
)
expect_equal(
report:::.text_effectsize("lovakov2021"),
"Effect sizes were labelled following Lovakov's (2021) recommendations."
)
expect_equal(
report:::.text_effectsize("evans1996"),
"Effect sizes were labelled following Evans's (1996) recommendations."
)
expect_equal(
report:::.text_effectsize("chen2010"),
"Effect sizes were labelled following Chen's (2010) recommendations."
)
expect_equal(
report:::.text_effectsize("field2013"),
"Effect sizes were labelled following Field's (2013) recommendations."
)
expect_equal(
report:::.text_effectsize("landis1977"),
"Effect sizes were labelled following Landis' (1977) recommendations."
)

# Test custom rule names (strings not in predefined list)
expect_equal(
report:::.text_effectsize("Unknown"),
"Effect sizes were labelled following a custom set of rules."
)
expect_equal(
report:::.text_effectsize("MyCustomRules"),
"Effect sizes were labelled following a custom set of rules."
)
expect_equal(
report:::.text_effectsize("CustomRule2024"),
"Effect sizes were labelled following a custom set of rules."
)

# Test non-character input (should also return custom rules text)
expect_equal(
report:::.text_effectsize(123),
"Effect sizes were labelled following a custom set of rules."
)
expect_equal(
report:::.text_effectsize(list()),
"Effect sizes were labelled following a custom set of rules."
)
})