Description Usage Arguments Details Value Examples
A wrapper for the make.names()
function to make syntatically
valid names using my preferred syntax.
1 |
df |
Any object with a name, but I typically use them for data frames, hence "df". |
Replaces spaces with underscore
Sets all letters to lower case
Injects an "x" before a syntatically invalid beginning (e.g. a number, or symbol)
Indicates duplicate names with a "_n", where n is the nth duplicate
Returns the object you fed it with changed names.
1 2 3 4 5 6 7 8 9 10 11 12 | # Using a data.frame
df <- data.frame("Happy Boy" = c(1:10),
"3BeeSoup " = c(letters[1:10]),
"Happy Boy" = c(10:1))
clean_names(df)
# Using a tibble
df2 <- dplyr::tibble(`Happy Boy` = c(1:10),
`3BeeSoup ` = c(letters[1:10]))
clean_names(df2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.