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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plot.R

Description

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

Usage

1
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

Other Utility functions: findAbsMin(), find_n_neighbors(), firstLetterCap(), getArrowPos(), getDec(), getRange(), getRatioCoords(), get_palette(), group_sort(), inch2coords(), isColor(), list2str(), move_n_point(), orderBoxplot(), se()

Examples

1
2
3
4
5
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 documentation built on April 28, 2020, 5:10 p.m.