to_camel: to_camel

View source: R/camel_snake.R

to_camelR Documentation

to_camel

Description

Converts a vector of strings (e.g., column names) from snake_case to camelCase. (Specifically, lower camel case.)

Usage

to_camel(x, nums_to_camel = T)

Arguments

x

An atomic vector (character or coercible to character).

nums_to_camel

Should numbers be cameled as well? ('z_1_a' –> 'z1A')

Details

to_camel() will return the input as a character vector with a warning unless there is at least one underscore not in the first position somewhere in the set of input strings.

E.g., to_camel(c('aaa', 'bbb', '_ccc')) will return x and a warning.

No dependencies.

Value

A vector.

Examples

snakes <- c('rainbow_boa', 'blue_racer', 'dragon_snake',
'a_set_of_5_garter_snakes', 'a_larger_set_of_6_kingsnakes')
to_camel(snakes)


jacob-gg/manager documentation built on July 2, 2024, 2:09 a.m.