Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how unspecified ... arguments are passed to other functions #443

Merged
merged 2 commits into from
Jun 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Minor changes
* `report` now supports reporting of BayesFactor objects with variables of class `BFBayesFactor`.
* `report_sample()` now suggests valid column names for misspelled columns in the `select`, `by`, `weights` and `exclude` arguments.

Bug fixes

* Fixed issues with incorrectly passing additional arguments to downstream
functions in `report()` for `htest` objects.

# report 0.5.8

New features
Expand Down
2 changes: 1 addition & 1 deletion R/report_htest_chi2.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
# report_effectsize ---------------------

.report_effectsize_chi2 <- function(x, table, dot_args, rules = "funder2019") {
if (chi2_type(x) %in% c("pearson", "probabilities")) {

Check warning on line 12 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=12,col=3,[unnecessary_nesting_linter] Reduce the nesting of this if/else statement by unnesting the portion without an exit clause (i.e., stop(), return(), abort(), quit(), q()).
args <- c(list(x), dot_args)

Check warning on line 13 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=13,col=5,[object_overwrite_linter] 'args' is an exported object from package 'base'. Avoid re-using such symbols.
table <- do.call(effectsize::effectsize, args)
table_footer <- attributes(table)$table_footer
ci <- attributes(table)$ci
estimate <- names(table)[1]
rules <- ifelse(is.null(dot_args$rules), rules, dot_args$rules)

args <- list(table, rules = rules, dot_args)
args <- c(list(table, rules = rules), dot_args)

Check warning on line 20 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=20,col=5,[object_overwrite_linter] 'args' is an exported object from package 'base'. Avoid re-using such symbols.
interpretation <- do.call(effectsize::interpret, args)$Interpretation
rules <- .text_effectsize(attr(attr(interpretation, "rules"), "rule_name"))
} else {
Expand All @@ -26,7 +26,7 @@
), call. = FALSE)
}

if (estimate == "Cramers_v_adjusted") {

Check warning on line 29 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=29,col=3,[if_switch_linter] Prefer switch() statements over repeated if/else equality tests, e.g., switch(x, a = 1, b = 2) over if (x == "a") 1 else if (x == "b") 2.
main <- paste0("Adjusted Cramer's v = ", insight::format_value(table[[estimate]]))
} else if (estimate == "Fei") {
main <- paste0("Fei = ", insight::format_value(table[[estimate]]))
Expand Down Expand Up @@ -76,10 +76,10 @@
.report_model_chi2 <- function(x, table) {
if (chi2_type(x) == "pearson") {
type <- " of independence between"
vars_full <- paste0(names(attributes(x$observed)$dimnames), collapse = " and ")

Check warning on line 79 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=79,col=18,[paste_linter] Use paste(), not paste0(), to collapse a character vector when sep= is not used.
} else if (chi2_type(x) == "probabilities") {
type <- " / goodness of fit of "
dist <- ifelse(

Check warning on line 82 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=82,col=5,[object_overwrite_linter] 'dist' is an exported object from package 'stats'. Avoid re-using such symbols.
grepl("non", attr(table, "table_footer"), fixed = TRUE), "a uniform distribution",
paste0("a distribution of [", paste0(
names(x$expected), ": n=", x$expected,
Expand All @@ -90,7 +90,7 @@
vars_full <- paste(x$data.name, "to", dist)
}

text <- paste0(

Check warning on line 93 in R/report_htest_chi2.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_chi2.R,line=93,col=3,[object_overwrite_linter] 'text' is an exported object from package 'graphics'. Avoid re-using such symbols.
trimws(x$method),
type,
paste0(" ", vars_full)
Expand Down
2 changes: 1 addition & 1 deletion R/report_htest_fisher.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# report_effectsize ---------------------

.report_effectsize_fisher <- function(x, table, dot_args, rules = "funder2019") {
args <- c(list(x), dot_args)

Check warning on line 12 in R/report_htest_fisher.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_fisher.R,line=12,col=3,[object_overwrite_linter] 'args' is an exported object from package 'base'. Avoid re-using such symbols.
table <- do.call(effectsize::effectsize, args)
ci <- attributes(table)$ci
estimate <- names(table)[1]
rules <- ifelse(is.null(dot_args$rules), rules, dot_args$rules)

args <- list(table, rules = rules, dot_args)
args <- c(list(table, rules = rules), dot_args)

Check warning on line 18 in R/report_htest_fisher.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_fisher.R,line=18,col=3,[object_overwrite_linter] 'args' is an exported object from package 'base'. Avoid re-using such symbols.
interpretation <- do.call(effectsize::interpret, args)$Interpretation
rules <- .text_effectsize(attr(attr(interpretation, "rules"), "rule_name"))

if (estimate == "Cramers_v_adjusted") {

Check warning on line 22 in R/report_htest_fisher.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/report_htest_fisher.R,line=22,col=3,[if_switch_linter] Prefer switch() statements over repeated if/else equality tests, e.g., switch(x, a = 1, b = 2) over if (x == "a") 1 else if (x == "b") 2.
main <- paste0("Adjusted Cramer's v = ", insight::format_value(table[[estimate]]))
} else if (estimate == "Tschuprows_t") {
main <- paste0("Tschuprow's t = ", insight::format_value(table[[estimate]]))
Expand Down
2 changes: 1 addition & 1 deletion R/report_htest_ttest.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
estimate <- names(table)[1]
rules <- ifelse(is.null(dot_args$rules), rules, dot_args$rules)

my_args <- list(table, rules = rules, dot_args)
my_args <- c(list(table, rules = rules), dot_args)
interpretation <- do.call(effectsize::interpret, my_args)$Interpretation
rules <- .text_effectsize(attr(attr(interpretation, "rules"), "rule_name"))

Expand Down
Loading