The levels of an annotated factor are re-ordered so that the level specified
by ref is first and the others are moved down. This is useful
for contr.treatment contrasts which take the first level as the
reference.
# S4 method for annotated_factor,character
relevel(x, ref)# S4 method for annotated_factor,numeric
relevel(x, ref)
An object of class annotated_factor.
The reference level, typically a character. Contrary to the original behavior, you can also specify a character vector of any length: As many levels as you specified will be re-ordered (standard behavior issued an error).
An annotated factor of the same length as x.
Currently, two methods for reordering the levels of an annotated_factor are implemented:
The annotated_factor,character-method reorders the levels according to the ordering in a character vector ref.
The annotated_factor,integer-method reorders the levels according to their position within the vector of levels
(as would be returned by levels).