-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for using stage()
with a mapping specified for start
only
#6131
Add test for using stage()
with a mapping specified for start
only
#6131
Conversation
If this PR makes sense, I'd also like to clean up this comment about how "there should always be two arguments to stage()" :) Lines 334 to 335 in 4fbc857
|
Thanks for the PR, June! I agree that
This might be nice to include in
This makes sense to me. |
Will think a bit about this! |
I added a bit to the "Complex staging" section to spell out this equivalence (of ex: |
I like it :) Do you think this is good to go or do you envision more edits? |
That's it! Nothing else in my mind for the scope of this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks June for the contribution!
This PR adds tests to codify the behavior of
aes(stage(x))
and its variants working equivalently toaes(x)
.I had been under the impression that
stage(x)
will remain invalid since #4890 was closed without a follow-up (and with a general agreement that this is an odd thing to do), but that issue seems to have been resolved a while back as part of a larger PR in #5409. I assume that the currently working behavior ofstage(x)
is intended and desirable, and I would personally like for this to be guaranteed as a stable behavior (or at least, for there to be tests to detect its unintended regression).Hence, the PR adds three tests of equivalence between
aes(x)
and:aes(stage(x))
aes(stage(start = x))
aes(stage(start = x, after_stat = NULL, after_scale = NULL))
I saw some prior discussion on the significance of resolving an unnamed value passed to
start
, so the test includes both (1) and (2). I added (3) just for completeness, but can be removed if this is a weird thing to test (perhaps more meaningful is testing whether (3) works when other arguments are dynamically evaluated toNULL
, but I digress).In case
stage(x)
wasn't intended and the question of its desirability is still up in the air, I want to advocate for this with a pedagogical use-case: the practical equivalence betweenaes(x)
andaes(stage(x))
makes the introduction of more advanced strategies only one-step removed and thus easier to teach/learn, e.g.,aes(fill = stage(x, after_scale = darken(fill, .5)))