I am running the following script on R 3.6.3 on Windows 10 (64 Bit). tidyverse is 1.3.0, dplyr is 0.8.5, and tidyselect is 1.0.0.
# Sys information
sorted_vars<- c("first_var", "second_var", "third_var", "fourth_var")
# Variable names in original ordermy_tibble %>% names# all_of gives an error because of no "fourth_var"
select(my_tibble, all_of(sorted_vars)) %>%
names# any_of works but does not respect order in "sorted_vars"
select(my_tibble, any_of(sorted_vars)) %>%
names# this works as expected
) %>% names
At first variables are sorted in the orginal tibble order.
From the help file ("The order of selected columns is determined by the inputs."), I would also have expected any_of to respect the order of variable names provided. Am I missing out on something here?
The text was updated successfully, but these errors were encountered: