| sortGroups {plotfunctions} | R Documentation |
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
|
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
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)]
[Package plotfunctions version 1.4 Index]