Skip to contents

This function is superseded by the more versatile transform.scdf function.

Usage

ranks(data, var, grand = TRUE, ...)

Arguments

data

A single-case data frame. See scdf() to learn about this format.

var

A string or string vector with the names of the variables to be ranked.

grand

If TRUE, ranks will be calculated across all cases. If FALSE ranks are calculated within each case.

...

Additional parameters passed to the rank function.

Value

An scdf object where the values of the variable(s) are replaced with ranks.

See also

Author

Juergen Wilbert

Examples

# The ranks function is deprecated. Please use transform:
res1 <- ranks(Huber2014, var = "compliance")
res2 <- transform(Huber2014, across_cases(compliance = rank(compliance, na.last="keep")))
identical(res1, res2)
#> [1] TRUE

res1 <- ranks(Huber2014, var = "compliance", grand = FALSE)
res2 <- transform(Huber2014, compliance = rank(compliance, na.last="keep"))
identical(res1, res2)
#> [1] TRUE