I am trying use the arrange()
function from dplyr
but specify the column dynamically.
Here is a reprex:
dt <- tibble(
foo = 1:10,
bar = 101:110
)
sort_by <- 'bar'
dt %>% arrange(sort_by) # does not work
dt %>% arrange(!!quo_name(sort_by)) # does not work either
What is the correct way to pass a dynamic column name to arrange()
?