fct_reorder

Order factor levels by another vector

Reorders factor levels using summary statistics computed from a companion numeric vector.

Parameters

Returns

A factor vector with levels reordered by the summary of x.

Examples

fct_reorder(fct, values)
fct_reorder(fct, values, .desc = true)