sortVars {iNZightTools} | R Documentation |
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 |
a dataframe to sort |
vars |
a character vector of variable names to sort by |
asc |
logical, same length as |
data.frame with tidyverse code attached
Owen Jin
sorted <- sortVars(iris, vars = c("Sepal.Width", "Sepal.Length"),
asc = c(TRUE, FALSE))
cat(code(sorted))
head(sorted)