rank_vars: Rank the data of numeric variables

View source: R/mutate.R

rank_varsR Documentation

Rank the data of numeric variables

Description

Rank the values of numeric variables, for example, in descending order, and then returns the result along with tidyverse code used to generate it. See row_number and percent_rank.

Usage

rank_vars(data, vars, rank_type = c("min", "dense", "percent"))

Arguments

data

a dataframe with the variables to rank

vars

a character vector of numeric variables in data to rank

rank_type

either "min", "dense" or "percent", see row_number, percent_rank

Value

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

Author(s)

Zhaoming Su

See Also

code

Examples

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


iNZightTools documentation built on Oct. 12, 2023, 5:06 p.m.