Skip to content

Pass zeros on in ranktransform() for data frames - #755

Open
jmgirard wants to merge 1 commit into
mainfrom
hotfix-ranktransform-zeros
Open

jmgirard wants to merge 1 commit into
mainfrom
hotfix-ranktransform-zeros

Conversation

@jmgirard

Copy link
Copy Markdown
Contributor

ranktransform.data.frame() and ranktransform.grouped_df() take a zeros argument but didn't pass it on to the column method, so zeros = "signrank" was ignored. For d <- data.frame(x = c(-1, 0, 2, -3, 4)), ranktransform(d, sign = TRUE, zeros = "signrank") gave -1 NA 2 -3 4 with the "Zeros detected" warning, where the vector method gives -2 0 3 -4 5.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain, with the change focused on forwarding zeros and accompanied by targeted regression tests for ungrouped and grouped data frames.

No open issues 🎉

What changed in this PR

This PR fixes ranktransform() for data frames and grouped data frames by forwarding the zeros argument to the column-level method, ensuring zeros = "signrank" correctly preserves zeros during signed ranking.

Changes:

  • Forward zeros through data-frame and grouped-data-frame transformations.
  • Add regression tests for ungrouped and grouped data frames.
  • Document the bug fix in NEWS.md.
File Description
tests/​testthat/​test-ranktransform.R Adds regression tests verifying signed-rank handling of zeros for data frames and grouped data frames.
R/​ranktransform.R Forwards the zeros argument through data-frame and grouped-data-frame transformation methods.
NEWS.md Documents the corrected forwarding of the zeros argument.

Review effort: Lite

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants