dt_set_clean_names: Takes a data.table and set to cleaned column names

dt_set_clean_namesR Documentation

Takes a data.table and set to cleaned column names

Description

This function takes a data.table, and returns the same data.table with column names that are cleaned and stripped of potentially troublesome names

Usage

dt_set_clean_names(DT, lower = TRUE)

Arguments

DT

a data.table

lower

A logical indicating whether all column names should be made lower case (default TRUE).

Details

All space/whitespace characters are replaced with underscores, as are all characters not from A-Z, a-z, an underscore, or a digit

Value

Returns the data.table but with cleaned names

See Also

get_clean_names

Examples


ejemplo <- as.data.table(iris)
setnames(ejemplo, c("Sepal Length", "Sepal@Width", "Petal	Length",
                    "Petal\\nWidth", "SpĂȘcies"))
dt_set_clean_names(ejemplo)


libbib documentation built on Nov. 10, 2022, 6:16 p.m.