fix: improve error message when expand/complete on grouping column (#1509)#1636
Closed
LeonidasZhak wants to merge 2 commits into
Closed
fix: improve error message when expand/complete on grouping column (#1509)#1636LeonidasZhak wants to merge 2 commits into
LeonidasZhak wants to merge 2 commits into
Conversation
Filter out infinite values before computing range in full_seq.numeric(). This prevents the cryptic 'missing value where TRUE/FALSE needed' error when input contains Inf or -Inf values. Fixes tidyverse#1496
…idyverse#1509) - Add clear error message when trying to expand or complete on a grouping column - Error now says 'Can't expand/complete on a grouping column' instead of cryptic 'object not found' - Suggests using ungroup() or working with non-grouping columns - Updated tests to use snapshot testing for error messages
Author
|
I am withdrawing this PR as part of a broader cleanup of an oversized automated contribution batch. I am sorry for the review noise and the pressure this may have put on maintainers. Going forward I will keep contributions to this project much more limited and higher-signal, ideally only one or two focused PRs at a time. Thank you for maintaining the project. |
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.
Problem
When calling
expand()orcomplete()on a grouped data frame with a grouping column, the error message was confusing:The error "object 'x' not found" is misleading because
xexists in the data, but it's a grouping column that isn't available in the data mask used bypick(everything()).Solution
Added explicit checks in
expand.grouped_df()andcomplete.grouped_df()to detect when the user tries to expand/complete on a grouping column and provide a clear, actionable error message:Changes
R/expand.R: Added check for grouping columns inexpand.grouped_df()R/complete.R: Added check for grouping columns incomplete.grouped_df()tests/testthat/test-expand.R: Updated test to use snapshot testingtests/testthat/test-complete.R: Updated test to use snapshot testingtests/testthat/_snaps/expand.md: Added snapshot for new error messagetests/testthat/_snaps/complete.md: Added snapshot for new error messageValidation
Related Issues
Closes #1509