to_snake | R Documentation |
Converts a vector of strings (e.g., column names) from camelCase to snake_case.
to_snake(x, nums_to_snake = T)
x |
An atomic vector (character or coercible to character). |
nums_to_snake |
Should numbers be snaked as well? ('z1' –> 'z_1') |
to_snake()
will return the input as a character vector with a warning
unless there is at least one capital letter not in the first position somewhere
in the set of input strings.
E.g., to_snake(c('aaa', 'bbb', 'Ccc'))
will return x
and a warning.
No dependencies.
A vector.
camels <- c('dromedaryCamel', 'wildBactrianCamel', 'BactrianLookingUp',
'aCaravanOf10Camels', 'aLargerCaravanOf11')
to_snake(camels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.