-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Separate transmute()
from mutate(.keep = "none")
#6086
Comments
jonkeane
pushed a commit
to apache/arrow
that referenced
this issue
Apr 7, 2022
…option is set This PR does two things to match some dplyr behaviour around column order: 1) Mimics dplyr implementation of `mutate(..., .keep = "none")` to append new columns after the existing columns (if suggested) as [per](tidyverse/dplyr#6086) 2) As per this [discussion](tidyverse/dplyr#6086), this required a bespoke approach to `transmute` as it not simply a wrapper for `mutate(..., .keep = "none")`. This cascades into needing to catch a couple edge cases. I have also added some tests which will test for this behaviour. Closes #12818 from boshek/mutate-keep Authored-by: SAm Albers <[email protected]> Signed-off-by: Jonathan Keane <[email protected]>
jcralmeida
pushed a commit
to rafael-telles/arrow
that referenced
this issue
Apr 19, 2022
…option is set This PR does two things to match some dplyr behaviour around column order: 1) Mimics dplyr implementation of `mutate(..., .keep = "none")` to append new columns after the existing columns (if suggested) as [per](tidyverse/dplyr#6086) 2) As per this [discussion](tidyverse/dplyr#6086), this required a bespoke approach to `transmute` as it not simply a wrapper for `mutate(..., .keep = "none")`. This cascades into needing to catch a couple edge cases. I have also added some tests which will test for this behaviour. Closes apache#12818 from boshek/mutate-keep Authored-by: SAm Albers <[email protected]> Signed-off-by: Jonathan Keane <[email protected]>
pwwang
added a commit
to pwwang/datar-pandas
that referenced
this issue
Apr 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #6035 we reworked
.keep
to be more consistent formutate()
. I still stand by this decision in the context ofmutate()
, but this has changed the behavior oftransmute()
, since that is currentlymutate(.keep = "none")
. Here is a good example that shows the change in behavior for both group-vars and modified non-group vars.It turns out that many people want
transmute()
to keep the current CRAN behavior because they use it for mixed selection and mutation and expect a specific column ordering from it.We previously believed that
transmute()
had swapped between these two outputs over various dplyr releases, but this was actually not true, as seen in #6080 (comment). The current CRAN behavior has always been howtransmute()
works. In light of this, we believe we should retain the CRAN behavior oftransmute()
for the next dplyr release.That said,
mutate(.keep = "none")
should retain its current dev behavior. This is an experimental argument, so changing it should not affect too many users. The dev behavior of.keep = "none"
is overall more consistent with the rest of themutate()
options, makes it easier to predict the output when combined with.before
and.after
, and simplifies the implementation because it means that.keep
never affects the column ordering, it is mainly about which columns get dropped (#6035 goes into this in great detail).So, the action items are:
transmute()
to revert to the CRAN behavior, which requires giving it its own implementation separate frommutate()
.keep
transmute()
and.keep = "none"
in the documentation, making it clear how those are differentThe text was updated successfully, but these errors were encountered: