Learn R Programming

ammistability (version 0.1.4)

rankdf: Ranks in a data.frame

Description

Ranks in a data.frame

Usage

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

Value

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

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().

Examples

Run this code
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