sort_vars | R Documentation |
Sorts a dataframe by one or more variables, and returns the result along with tidyverse code used to generate it.
sort_vars(data, vars, asc = rep(TRUE, length(vars)))
data |
a dataframe to sort |
vars |
a character vector of variable names to sort by |
asc |
logical, length of 1 or same length as |
data with tidyverse code attached
Owen Jin, Zhaoming Su
code
sorted <- sort_vars(iris,
vars = c("Sepal.Width", "Sepal.Length"),
asc = c(TRUE, FALSE)
)
cat(code(sorted))
head(sorted)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.