Error informatively when xobs_only() arguments are named or unknown - #112
Merged
Merged
Conversation
A named argument inside xobs_only() failed with an internal stopifnot from xcast() and a dplyr cross-join deprecation warning. Names are now rejected up front, since a new column has no observed combinations to preserve, and semi_crossing() errors when an argument does not refer to a column of .data instead of falling through to an empty join. Closes #111. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.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 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.
Closes #111.
A named argument inside
xobs_only()failed with an internalstopifnot()fromxcast()and, when it was the only argument, a dplyr cross-join deprecation warning attributed to newdata:Approach
Names are rejected rather than applied.
xobs_only()preserves the combinations observed in.data, and a new column has no observed combinations, so a rename has nothing well defined to join on for a bare vector such asz = new_seq(b).Naming the whole call,
xnew_data(d, z = xobs_only(b)), continues to create a new column as #102 documents.xobs_only()errors when any argument is named, naming the offending arguments.semi_crossing()errors when a resulting column is not in.data, which also covers an unnamed bare vector, instead of falling through to an emptybyand a cross join....documentation states that arguments must be unnamed variables in.data.Checks
R CMD check: 0 errors, 0 warnings, 0 notes.test-xobs-only.Rcovers the observed-combination behaviour and snapshots the four error cases.🤖 Generated with Claude Code