Feature: set_channel() sets or skips NA values#40
Open
zeehio wants to merge 21 commits intothomasp85:mainfrom
Open
Feature: set_channel() sets or skips NA values#40zeehio wants to merge 21 commits intothomasp85:mainfrom
zeehio wants to merge 21 commits intothomasp85:mainfrom
Conversation
Owner
|
Hi @zeehio Thanks for all the work you are doing here and in the ggplot2 repo. It is much appreciated. I'm currently fully occupied with preparing the next ggplot2 release so I do not have time to sit down with all the PRs right now, but will once ggplot2 has been released. Feel free to continue the work in the meantime or let it sit and we can have a talk about your proposals. Best |
Author
|
Hi @thomasp85, Thanks for your reply. No worries and no hurries. I don't want to bury you under pull requests 😃 . I would be very happy to talk with you. Feel free to send me an email at sergioller@gmail.com to schedule it at your convenience. Thank you and good luck with the ggplot2 release 👍 Best, |
When a replacement value is `NA`, two behaviours may be expected: - Set the colour to `NA` - Ignore the modification and leave the colour as it was Here we introduce skip_na_values. If `FALSE` (the default), when the replacement value is NA we set the colour to NA. If `TRUE`, when the replacement value is NA we leave the colour unmodified.
So I can depend on these patches on my Remotes:
33c96f3 to
8624c8c
Compare
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.
Sorry for so many pull requests.
On top of #39 (please review them in order), this pull request deals with the behaviour of missing values in functions that modify channels.
When a replacement value is
NA, two behaviours may be expected depending to what we understand aNAmodification to be:NA(e.g.set_channel("black", "r", NA)returnsNA)set_channel("black", "r", NA)returns"black")Both interpretations make sense to me.
The current specification handles the case when
colouris missing (thena_valueis used). However it does not specify the behaviour whenvalueis missing. Currently, in all cases but one (a bug, see below) the behaviour is to set the correspondingcolourtoNA(the "modification is invalid" intepretation).In this pull request we introduce the
skip_na_valuesargument. IfFALSE(the default), when the replacement value isNAwe set the colour toNA. IfTRUE, when the replacement value isNAwe leave the colour unmodified.While working on this feature I fixed an inconsistency in how the alpha channel handled missing values. If you believe it only makes sense to keep one interpretation, please tell me and I will close this pull request and replace it with another one that:
NAinvalueCreated on 2022-09-20 with reprex v2.0.2
Thanks, and again apologies for all the extra work!