Description Usage Arguments Value Author(s) See Also Examples
Function uses sort.list
to return indices
of of a vector, sorted per group.
1 | group_sort(x, group = NULL, decreasing = FALSE)
|
x |
A vector to be sorted. |
group |
A names list that specify the different groups to split the data. |
decreasing |
Logical: whether or not the sort order should be decreasing. |
Indices indicating the order of vector x per group.
Jacolien van Rij
Other Utility functions:
findAbsMin()
,
find_n_neighbors()
,
firstLetterCap()
,
getArrowPos()
,
getDec()
,
getRange()
,
getRatioCoords()
,
get_palette()
,
inch2coords()
,
isColor()
,
list2str()
,
move_n_point()
,
orderBoxplot()
,
se()
,
sortGroups()
1 2 3 4 5 6 7 | # example InsectSprays from R datasets
InsectSprays$Type <- ifelse(InsectSprays$spray %in% c('A','B', 'F'), 1, 2)
ind <- group_sort(InsectSprays$count,
group=list(Spray=InsectSprays$spray, Type=InsectSprays$Type))
InsectSprays[ind,]
InsectSprays
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.