Learn R Programming

ammistability (version 0.1.1)

rankdf: Ranks in a data.frame

Description

Ranks in a data.frame

Usage

rankdf(df, increasing = NULL, decreasing = NULL, ...)

Arguments

df

A data frame.

increasing

A character vector of column names of the data frame to be ranked in increasing order.

decreasing

A character vector of column names of the data frame to be ranked in decreasing order.

...

Additional arguments to be passed on to rank().

Value

A data frame with the ranks computed in the columns specified in arguments increasing and decreasing.

Examples

Run this code
# NOT RUN {
library(agricolae)
data(soil)

dec <- c("pH", "EC")
inc <- c("CaCO3", "MO", "CIC", "P", "K", "sand",
         "slime", "clay", "Ca", "Mg", "K2", "Na", "Al_H", "K_Mg", "Ca_Mg",
         "B", "Cu", "Fe", "Mn", "Zn")

soilrank <- rankdf(soil, increasing = inc, decreasing = dec)
soilrank
# }

Run the code above in your browser using DataLab