rankVars {iNZightTools} | R Documentation |
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
rankVars(.data, vars)
.data |
a dataframe with the variables to rank |
vars |
a character vector of numeric variables in |
the original dataframe containing new columns with the ranks of the
variables in var
with tidyverse code attached
Owen Jin
ranked <- rankVars(iris, vars = c("Sepal.Length", "Petal.Length"))
cat(code(ranked))
head(ranked)