Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sortGroups

Sort groups based on a function such as mean value or deviation.


Description

Sort groups based on a function such as mean value or deviation.

Usage

sortGroups(formula, FUN = "mean", decreasing = FALSE, ...)

Arguments

formula

Formula for splitting the data

FUN

Function to apply to each group

decreasing

Logical: sort groups on decreasing values or not (default is FALSE, sorting on increasing values).

...

Additional arguments for the function aggregate.

Value

The order of levels.

Author(s)

Jacolien van Rij

See Also

Examples

head(ToothGrowth)
# sort on basis of mean length:
sortGroups(len ~ dose:supp, data = ToothGrowth)
labels = levels(interaction(ToothGrowth$dose, ToothGrowth$supp))
labels[sortGroups(len ~ dose:supp, data = ToothGrowth)]

plotfunctions

Various Functions to Facilitate Visualization of Data and Analysis

v1.4
GPL (>= 2)
Authors
Jacolien van Rij [aut, cre]
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.