Repository navigation
Return columns normalize(), ranktransform(), and center() can't handle unchanged - #754
Merged
Merged
Conversation
… handle unchanged
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
Same issue as inranktransform.default(): theinsight::format_alert()return value is not used,… · Newinsight::format_alert()typically returns formatted text but doesn’t emit it; since the return… · New The new “return unchanged + message” behavior isn’t directly asserted in tests. Add test coverage… · New The comment is inaccurate: all R objects haveattributes(), but unsupported columns won’t have… · New
What changed in this PR
Fixes normalize(), ranktransform(), and center() failures on data frames that include columns whose classes aren’t transformable (e.g., Date), ensuring such columns remain unchanged and don’t break attribute handling.
Changes:
- Add
normalize.default()andranktransform.default()to return unsupported classes unchanged (optionally emitting a message). - Propagate
verbosethroughranktransform.data.frame()/ranktransform.grouped_df()to silence the new message when requested. - Update
center.data.frame()to only readcenter/scaleattributes from columns that were actually centered; add regression tests.
| File | Description |
|---|---|
| tests/testthat/test-ranktransform.R | Adds regression coverage for data frames containing a Date column. |
| tests/testthat/test-normalize.R | Adds regression coverage for normalize() on data frames containing a Date column. |
| tests/testthat/test-center.R | Adds regression coverage for center() on data frames containing a Date column. |
| R/ranktransform.R | Adds ranktransform.default() and passes verbose through data frame/grouped methods. |
| R/normalize.R | Adds normalize.default() to avoid errors on unsupported classes. |
| R/center.R | Fixes attribute extraction to only consider columns that were actually centered. |
| NEWS.md | Documents the bug fix and new behavior (unchanged columns + message). |
| NAMESPACE | Registers new S3 default methods for normalize() and ranktransform(). |
Review effort: Lite
Contributor
Author
|
Copilot's review says |
Copilot stopped reviewing on behalf of
jmgirard due to an error
November 26, 2026 01:38
strengejacke
approved these changes
Nov 26, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



normalize()andranktransform()failed with "no applicable method" on a data frame with a column of a class that has no method, such asDate,POSIXct, orhaven_labelled.center()failed on the same data frames, becausecenter.data.frame()reads thecenterattribute of every selected column, and a skipped column has none:This adds
normalize.default()andranktransform.default(), which return the column unchanged with a message, likerescale.default().center()now reads the attributes only from the columns it centered. The data frame methods ofranktransform()now passverboseon, soverbose = FALSEsilences the new message.