[R] Skipping columns to save memory
Duncan Murdoch
murdoch at stats.uwo.ca
Fri May 30 15:25:01 CEST 2008
On 5/30/2008 8:54 AM, Doran, Harold wrote:
> 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?
If an entry in colClasses is set to "NULL", then that column is skipped.
Duncan Murdoch
More information about the R-help
mailing list