Convert a vector to an ordered factor but stop if any of the values in
x
does not match the predefined levels in levels.
character_to_ordered(x, levels, name = substitute(x))
A character vector.
A vector with levels.
The name of the character vector to be displayed if the construction of the factor fails.