What you want is the option colClasses
of read.table()
(and the derivative functions). It allows you to pass a character
vector with the classes of each column in the data. If you set that to "NULL"
the column will be skipped. You can set the whole thing to "NULL"
and then only change the ones you want to import (based on their class).
Proof of concept below.
cc <- rep('NULL', 100) ## skip all 100 columns
cc[c(2, 5)] <- 'integer' ## 2 and 5 are integer
cc[c(62, 58)] <- 'character' ## 62 and 58 will be imported as character
df <- read.csv('really-wide-data.csv', colClasses=cc)