powered by
Sorts a dataframe by one or more variables, and returns the result along with tidyverse code used to generate it.
sortVars(.data, vars, asc = rep(TRUE, length(vars)))
data.frame with tidyverse code attached
a dataframe to sort
a character vector of variable names to sort by
logical, same length as vars. If TRUE (default), sorted in ascending order, otherwise descending.
vars
TRUE
Owen Jin
code
sorted <- sortVars(iris, vars = c("Sepal.Width", "Sepal.Length"), asc = c(TRUE, FALSE)) cat(code(sorted)) head(sorted)
Run the code above in your browser using DataLab