I often need to read multiple tables that share some (but not all) columns which would be passed to colClasses. It would be then convenient to make one vector with all those column names, i.e. instead of
chrcols1 <- c('colA', 'colB')
dt1 <- fread(file1, colClasses=list(character=chrcols1))
chrcols2 <- c('colA', 'colC')
dt2 <- fread(file2, colClasses=list(character=chrcols2))
# etc
use
chrcolsAll <- c('colA', 'colB', 'colC')
dt1 <- fread(file1, colClasses=list(character=chrcolsAll))
dt2 <- fread(file2, colClasses=list(character=chrcolsAll))
Right now this is not allowed ( "Column name '%s' in colClasses[[%d]] not found" ) but instead of throwing an error we could just exclude those column names from further processing.
I often need to read multiple tables that share some (but not all) columns which would be passed to
colClasses. It would be then convenient to make one vector with all those column names, i.e. instead ofuse
Right now this is not allowed ( "Column name '%s' in colClasses[[%d]] not found" ) but instead of throwing an error we could just exclude those column names from further processing.