sortVars {iNZightTools}R Documentation

Sort data by variables

Description

Sorts a dataframe by one or more variables, and returns the result along with tidyverse code used to generate it.

Usage

sortVars(.data, vars, asc = rep(TRUE, length(vars)))

Arguments

.data

a dataframe to sort

vars

a character vector of variable names to sort by

asc

logical, same length as vars. If TRUE (default), sorted in ascending order, otherwise descending.

Value

data.frame with tidyverse code attached

Author(s)

Owen Jin

See Also

code

Examples

Run examples

sorted <- sortVars(iris, vars = c("Sepal.Width", "Sepal.Length"),
    asc = c(TRUE, FALSE))
cat(code(sorted))
head(sorted)


[Package iNZightTools version 1.12.2 Index]