To reverse the order of a column in a tibble using tidyverse in R, we can use the mutate()
and select()
functions from the dplyr
package. Here's an example:
main.r241 chars12 lines
In the mutate()
function, we use the rev()
function to reverse the order of column x
. In the select()
function, we use everything()
to keep all the remaining columns in the tibble.
The resulting tibble (my_tibble_reversed
) will have the same columns as the original tibble (my_tibble
), but with the values in column x
reversed.
gistlibby LogSnag