powered by
This function takes a data.table, and returns the same data.table with column names that are cleaned and stripped of potentially troublesome names
dt_set_clean_names(DT, lower = TRUE)
Returns the data.table but with cleaned names
a data.table
A logical indicating whether all column names should be made lower case (default TRUE).
TRUE
All space/whitespace characters are replaced with underscores, as are all characters not from A-Z, a-z, an underscore, or a digit
get_clean_names
ejemplo <- as.data.table(iris) setnames(ejemplo, c("Sepal Length", "Sepal@Width", "Petal Length", "Petal\\nWidth", "Spêcies")) dt_set_clean_names(ejemplo)
Run the code above in your browser using DataLab