I didn't find a dupe for this, though it seems like a very needed feature as many times we read files from .CSV that came from .XLS or .XLSX and their column names are not of standard format of R.
I'm well aware that you can do setnames(DT, make.names(names(DT))) but it is very inconvenient IMO.
Thanks