get_clean_names | R Documentation |
This function takes a data.frame, extracts the column names, and returns a vector of those column names but cleaned and stripped of potentially troublesome names
get_clean_names(dat, lower = TRUE)
dat |
A data.frame |
lower |
A logical indicating whether all column names should be
made lower case (default |
All space/whitespace characters are replaced with underscores, as are all characters not from A-Z, a-z, an underscore, or a digit
If there are duplicate column names after the cleaning, a message will show stating such and the duplicate column names will be make unique.
Returns a vector of cleaned names
make.unique
ejemplo <- iris
names(ejemplo) <- c("Sepal Length", "Sepal@Width", "Petal Length",
"Petal\\nWidth", "SpĂȘcies")
# c("sepal_length" "sepal_width" "petallength" "petal_nwidth" "sp_cies")
# c("Sepal_Length" "Sepal_Width" "PetalLength" "Petal_nWidth" "Sp_cies")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.