reorder_by_priority: Bring specified values in a vector to the front
Description
Reorders a vector so that any elements matching the values in values
appear first, in the order they appear in values. All remaining elements
are returned afterward, preserving their original order.
Usage
reorder_by_priority(x, priority_values)
Value
A reordered vector with priority values first, followed by all
remaining elements in their original order.
Arguments
x
A character or numeric vector to reorder.
priority_values
A vector of “priority” values. Elements of x that match
entries in priority_values are moved to the front in the order they appear in
priority_values. Values not found in x are ignored.