Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

convert_case

Generic case conversion for labels


Description

This function wraps to_any_case() from the snakecase package with certain defaults for the sep_in and sep_out arguments, used for instance to convert cases in term_labels.

Usage

convert_case(lab, case = NULL, verbose = FALSE, ...)

Arguments

lab

Character vector that should be case converted.

case

Desired target case. Labels will automatically converted into the specified character case. See to_any_case() for more details on this argument.

verbose

Toggle warnings and messages on or off.

...

Further arguments passed down to to_any_case(), like sep_in or sep_out.

Details

When calling to_any_case() from snakecase, the sep_in argument is set to "(?<!\\d)\\.", and the sep_out to " ". This gives feasible results from variable labels for plot annotations.

Value

lab, with converted case.

Examples

data(iris)
convert_case(colnames(iris))
convert_case(colnames(iris), case = "snake")

sjlabelled

Labelled Data Utility Functions

v1.1.8
GPL-3
Authors
Daniel Lüdecke [aut, cre] (<https://orcid.org/0000-0002-8895-3206>), avid Ranzolin [ctb], Jonathan De Troye [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.