snakeCase: Snake case

snakeCaseR Documentation

Snake case

Description

Format character strings to use snake-style formatting, where word boundaries are defined by underscores (e.g. this_is_snake_case).

Usage

snakeCase(object, ...)

## S4 method for signature 'character'
snakeCase(object, smart = TRUE, names = TRUE, prefix = TRUE)

Arguments

object

Object.

smart

logical(1). Handle complicated special cases, such as mixed case acronyms, plus/minus, percentages, etc.

names

logical(1). Sanitize names.

Only applies to string mode (rename = FALSE).

prefix

logical(1). Prepend "X" character if necessary, when string begins with a syntactically invalid character, such as a number or non-alphanumeric. Note that names are always made syntactically valid when applicable with "X" prefix. See make.names() for details.

Enabled by default for string mode, but disabled by default for rename mode, when applicable.

...

Additional arguments.

Value

Modified object. Contains syntatically valid names. For objects with names() defined, the underlying data returns unchanged, except for character or vector class.

Note

Updated 2020-07-08.

Examples

data(syntactic, package = "AcidTest")
object <- syntactic$character
snakeCase(object)

steinbaugh/syntactic documentation built on Oct. 31, 2023, 10:36 p.m.