Skip to contents

Correct the case of a vector to be in a preferred case

Usage

correct_case(x, preferred)

Arguments

x

An object to correct the case of

preferred

A character vector of preferred values

Value

`x` where values that match `tolower(x) == tolower(preferred)` are converted to the preferred value.

See also

Other Text standardization: replace_synonym()

Examples

correct_case(c("ABC", "Abc", "aBc", "def"), "Abc")
#> [1] "Abc" "Abc" "Abc" "def"