GH-34860: [R] New column name wrongly set when using mutate with if_any - #51314
Merged
Merged
Conversation
|
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review comments, and the fix includes focused regression coverage.
Pull request overview
Fixes R mutate() column naming for if_any() and if_all() by preserving user-provided names.
Changes:
- Preserve names during predicate expansion.
- Collapse predicates independently.
- Add regression tests for naming and mixed expressions.
File summaries
| File | Summary |
|---|---|
r/tests/testthat/test-dplyr-mutate.R |
Tests resulting mutate column names. |
r/tests/testthat/test-dplyr-across.R |
Tests predicate expansion and name preservation. |
r/R/dplyr-across.R |
Updates predicate expansion to retain names. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
thisisnic
force-pushed
the
GH-34860-mutate-if_any
branch
from
September 16, 2026 14:34
b1cbb4f to
928afe5
Compare
jonkeane
approved these changes
Sep 16, 2026
| # if_any()/if_all() collapse the expanded quosures into a single | ||
| # expression, keeping whatever name the user gave the call | ||
| if (is_call(quo_expr, c("if_any", "if_all"))) { | ||
| op <- if (is_call(quo_expr, "if_any")) "|" else "&" |
Member
There was a problem hiding this comment.
I'm fine to run with it, but the inline if/else is a little 🤢
Member
Author
There was a problem hiding this comment.
You're not wrong, I'll update
thisisnic
force-pushed
the
GH-34860-mutate-if_any
branch
from
September 17, 2026 17:30
4c1802d to
59744ab
Compare
jonkeane
approved these changes
Sep 17, 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.
Rationale for this change
We got errors with new column names when using
mutate()withif_any()due to not having access to column nameWhat changes are included in this PR?
Set the names
Are these changes tested?
Yeah
Are there any user-facing changes?
Yeah