Fix ard_stats_mantelhaen_test() failure on R-devel#343
Merged
Conversation
Splice the assembled argument list into stats::mantelhaen.test() with rlang::inject() instead of passing it as a single positional argument. The list was landing in the alternative= position, which older R tolerated but R-devel rejects, causing the statistic to be captured as NULL and cards::get_ard_statistics() to fail with 'attempt to set an attribute on NULL'. This was the only failing CRAN test on R-devel. Co-authored-by: Ona <no-reply@ona.com>
Contributor
Code Coverage SummaryDiff against mainResults for commit: 49a38f7 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Contributor
Unit Tests Summary 1 files 193 suites 1m 27s ⏱️ Results for commit 49a38f7. ♻️ This comment has been updated with latest results. |
Contributor
Unit Test Performance DifferenceAdditional test case details
Results for commit 67023f0 ♻️ This comment has been updated with latest results. |
Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
ard_stats_mantelhaen_test()where the assembled argument list was passed positionally tostats::mantelhaen.test()instead of being spliced into named arguments, causing a test failure on R-devel.The helper
.calc_mantelhaen_test()collectedalternative,correct,exact, andconf.levelinto a named list (mantelhaen.args) and passed it as a single positional argument tostats::mantelhaen.test(). That list landed in thealternative=position. Older R releases tolerated the malformed call, but R-devel's stricter argument handling rejects it: the statistic is captured asNULL, andcards::get_ard_statistics()then fails withattempt to set an attribute on NULL. This was the only failing test in the CRAN checks, and only on R-devel flavors.The fix wraps the call in
rlang::inject()and splices the list with!!!mantelhaen.args, matching the argument-splicing pattern already used elsewhere in the package (e.g.ard_stats_anova(),ard_regression_basic()).An audit of the sibling
ard_stats_*()andard_survey_*()functions found no other instances of this defect: they pass...directly to their underlying test call and only usedots_list(...)to record arguments in the ARD.CRAN checks: https://cran.r-project.org/web/checks/check_results_cardx.html
Reference GitHub issue associated with pull request.
Pre-review Checklist (if item does not apply, mark is as complete)
usethis::pr_merge_main()ard_*()function was added, it passes the ARD structural checks fromcards::check_ard_structure().ard_*()function was added,set_cli_abort_call()has been set.ard_*()function was added and it depends on another package (such as,broom),is_pkg_installed("broom")has been set in the function call and the following added to the roxygen comments.devtools::test_coverage()Reviewer Checklist (if item does not apply, mark is as complete)
devtools::test_coverage()When the branch is ready to be merged:
NEWS.mdwith the changes from this pull request under the heading "# cardx (development version)". If there is an issue associated with the pull request, reference it in parentheses at the end update (seeNEWS.mdfor examples).