I don't know how to choose specific columns using the colClasses
option in fread
. I tried to use NULL
in several ways but nothing worked. Here's a minimal example. I just want columns 1 and 3.
dt <- data.table(a=1:5,b=6:10,c=10:14)
write.csv(dt,"dt.csv",row.names=F)
dt <- fread("dt.csv",colClasses=?)
packageVersion("data.table")
[1] ‘1.8.10’
getRversion()
[1] ‘3.0.1’
The imported dataset should look like this:
a c
1: 1 10
2: 2 11
3: 3 12
4: 4 13
5: 5 14