You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@hadley, this is a great commit, but perhaps it should support multiple columns relocation (the thread title is indeed Allow mutate() to choose the position of new columns):
I agree @lionel-, but it would make sense in mutate() calls without suffix (as shown above), wouldn't it?
Perhaps for mutate_if() and mutate_at() a possibility would be to consider a .before = .x (or .after = .x) to imply that each newly created column goes before (or after) its source.
Activity
krlmlr commentedon Nov 7, 2016
hadley commentedon Nov 7, 2016
krlmlr commentedon Nov 7, 2016
hadley commentedon Feb 2, 2017
krlmlr commentedon Feb 2, 2017
lionel- commentedon Feb 2, 2017
hadley commentedon Feb 2, 2017
To me, that seems overly complicated. I think 90% of the time people just want variables to go in the front, instead of in the back.
krlmlr commentedon Feb 2, 2017
krlmlr commentedon Mar 30, 2017
romainfrancois commentedon Mar 27, 2018
krlmlr commentedon Mar 29, 2018
If we're only interested in supporting adding to the front, maybe we could use
transmute()
?@lionel-: What would it take to make the following syntax work?
34 remaining items
batpigandme commentedon Dec 5, 2019
braiam commentedon Dec 30, 2019
In MySQL we have two verbs, first and after , to add a column in a table with alter. Maybe dplyr can copy that behavior? It could also solve #4598.
hadley commentedon Dec 31, 2019
I'm once again leaning towards a
.where
argument, which would use tidyselect along the lines of r-lib/tidyselect#151.hadley commentedon Dec 31, 2019
Discussion of dedicated move verb at #4598
You can now use
transmute()
+across()
to add new cols at the start:[-]FR: `before` and `after` arguments to mutate()[/-][+]Allow mutate() to choose the position of new columns[/+]Control position of new mutate() columns (#4774)
courtiol commentedon Feb 8, 2020
@hadley, this is a great commit, but perhaps it should support multiple columns relocation (the thread title is indeed Allow mutate() to choose the position of new columns):
produces
and not
lionel- commentedon Feb 8, 2020
@courtiol Your suggestion would not work with plural selections like
starts_with()
oris.numeric
.courtiol commentedon Feb 8, 2020
I agree @lionel-, but it would make sense in mutate() calls without suffix (as shown above), wouldn't it?
Perhaps for
mutate_if()
andmutate_at()
a possibility would be to consider a.before = .x
(or.after = .x
) to imply that each newly created column goes before (or after) its source.