Sort Vectors by Priority
priority_sort.RdSort vectors, prioritizing according to levels specified. Uses
base::factor() internally with unspecified arguments disabled.
Arguments
- x
a vector of data, usually taking a small number of distinct values.
- levels
an optional vector of the unique values (as character strings) that
xmight have taken. The default is the unique set of values taken byas.character(x), sorted into increasing order ofx. Note that this set can be specified as smaller thansort(unique(x)).- exclude
a vector of values to be excluded when forming the set of levels. This may be factor with the same level set as
xor should be acharacter.