clean_colnames | R Documentation |
This function converts the column names of a data frame to lowercase, replaces whitespace (including tabs) with underscores, and removes any leading or trailing whitespace.
clean_colnames(dat)
dat |
A data frame. |
A data frame with cleaned column names.
# Example data frame
my_df <- data.frame("First Name\t" = c("John", "Jane", "Alice"),
"Last Name " = c("Doe", "Smith", "Johnson"),
"Age " = c(25, 30, 35))
# Clean column names: convert to lowercase, replace whitespace, and remove leading/trailing whitespace
cleaned_df <- clean_colnames(my_df)
colnames(cleaned_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.