As an simple example, I write cars
out without column names.
data.table::fwrite(cars, "cars.csv", col.names = FALSE)
and then I try to read them in with column names and by specifying the type of column a
data.table::fread("cars.csv", col.names = c("a","b"),
colClasses = list(a = "numeric"))
and I get this error
Error in data.table::fread("cars.csv", col.names = c("a", "b"), colClasses = list(a = "numeric")) : Column name 'numeric' in colClasses[[1]] not found