relevel_annotated: Reorder Levels of Annotated Factor

Description Usage Arguments Details Value See Also

Description

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.

Usage

1
2
3
4
5
## S4 method for signature 'annotated_factor,character'
relevel(x, ref)

## S4 method for signature 'annotated_factor,numeric'
relevel(x, ref)

Arguments

x

An object of class annotated_factor.

ref

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).

Details

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,numeric-method reorders the levels according to their position within the vector of levels (as would be returned by levels).

Value

An annotated factor of the same length as x.

See Also

relevel


mariusbarth/annotate4 documentation built on May 7, 2019, 3:14 p.m.