rankVars {iNZightTools}R Documentation

Rank the data of a numeric variables

Description

Rank the values of a numeric variable in descending order, and returns the result along with tidyverse code used to generate it. Ties are broken as such: eg. values = 5, 6, 6, 7 ; rank = 1, 2, 2, 3

Usage

rankVars(.data, vars)

Arguments

.data

a dataframe with the variables to rank

vars

a character vector of numeric variables in .data to rank

Value

the original dataframe containing new columns with the ranks of the variables in var with tidyverse code attached

Author(s)

Owen Jin

See Also

code

Examples

Run examples

ranked <- rankVars(iris, vars = c("Sepal.Length", "Petal.Length"))
cat(code(ranked))
head(ranked)


[Package iNZightTools version 1.12.2 Index]