This is useful for when the user wants to use the columns in a presentation. Shiny, Power BI, and RMarkdown are use cases where we may want clean column names for the user to read.
snake_to(object, format = "title", acronyms = NULL, names_only = FALSE)
object | A data.frame, ggplot or character vector object. A data.frame will have transformed column names. A ggplot object will have transformed X and Y axes. A character vector will have clean character names. |
---|---|
format | A string. The desired target (default is "title") case with options including:
|
acronyms | A Character. Default |
names_only | A Logical. Default |
Returns a data.frame with clean names, a ggplot object with clean axes, or a vector of clean strings.
if (FALSE) { # snake to title .data %>% snake_to() # snake to sentence .data %>% snake_to(format = "sentence") # snake to title, keep vector of transformed column names .data %>% snake_to(names_only = TRUE) # snake to title, capitalize acronyms acronyms <- c("pyr", "cyr") .data %>% snake_to(acronyms = acronyms) }