R: Convert a character vector to an ordered factor

character_to_ordered {styler} | R Documentation

## Convert a character vector to an ordered factor

### Description

Convert a vector to an ordered factor but stop if any of the values in `x` does not match the predefined levels in `levels.`

### Usage

    character_to_ordered(x, levels, name = substitute(x))

### Arguments

`x` | A character vector.
`levels` | A vector with levels.
`name` | The name of the character vector to be displayed if the construction of the factor fails.

[Package styler version 1.0.2 Index]