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.
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.
A better fix might be to replace the
transmute()
in the next line with arename()
followed by aselect()
that selects the columns in the order seen hereThere 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.
I am sorry I still don't get what the error is here..
chromosome
is the first variable, and should remain the first variable after themutate()
, which has always been the case, and it seems it is designed to remain like this.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.
Take
transmute(df, chromosome, marker.ID = alternate_ids, rsid)
as the example, which is identical totransmute(df, chromosome = chromosome, marker.ID = alternate_ids, rsid = rsid)
.By accident, that was previously putting the columns in the order they are specified, ignoring whether or not any of them already existed, so you'd get a column order of
(chromosome, marker.ID, rsid)
.This is inconsistent with how
mutate()
works, where the invariants are:So the correct resulting order should have been
(chromosome, rsid, marker.ID)
(assuming that in the original data frame,chromosome
was beforersid
), and that is now the case.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.
Wow.. Have you asked the community about this?
In
transmute()
, where you basically only keep the columns you are interested in (and forget about all the others), you kind of forget about the order as well and just want the order that you specify (at least this is what I want).Please keep it that way. This would break so much code..
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.
In this case, there's no need for
transmute()
and it can be replaced byselect()
which can rename as well. , I've updated the pull request.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.
Do you still plan to change the behaviour of
transmute()
in the next release of {dplyr}?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.
@privefl Hi, as explained in tidyverse/dplyr#6086, the behavior seems to have been modified to the original behavior (the behavior of the current CRAN release) again in tidyverse/dplyr#6087 to make it consistent with the past behavior of
transmute()
.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.
Great! Then I can close this.