Low-level functions for manipulating levelsSource:
lvls_reorder leaves values as they are, but changes the order.
lvls_revalue changes the values of existing levels; there must
be one new level for each old level.
lvls_expand expands the set of levels; the new levels must
include the old levels.
A factor (or character vector).
A integer index, with one integer for each existing level.
A logical which determines the "ordered" status of the output factor.
NApreserves the existing status of the factor.
A character vector of new levels.
These functions are less helpful than the higher-level
but are safer than the very low-level manipulation of levels directly,
because they are more specific, and hence can more carefully check their