[R] Skipping columns to save memory

Doran, Harold HDoran at air.org
Fri May 30 14:54:51 CEST 2008


I have a very large tab delimited file (~ 1.97 GB) that I need to read
in to R. The data contain 10 columns and there are millions of rows.

I need all rows of the data, but I only need the first column in the
data. I was looking at the ?read.delim and am trying to see if it is
possible to tell this function only to read in the first column and skip
the others.

The help file says the number of columns are determined from the first 5
rows of the data. So, I think one (very bad) option is to go into the
text file and manually delete columns 2:10 for the first 5 rows only.
Then, I think read.delim would think there is only 1 column in the data.

The skip function is of course only for rows AFAIK. 

help.search('skip columns read.delim')

Or  help.search('skip columns') didn't return anything.

Are there arguments in this function I have misunderstood or, are other
functions better for this problem?

Thanks
Harold



More information about the R-help mailing list