Re: [R] Skipping columns to save memory

From: Doran, Harold <HDoran_at_air.org>
Date: Fri, 30 May 2008 09:28:56 -0400


Thanks,

read.delim('cleanitem.txt', header = TRUE, nrows = 10, colClasses = rep(c("factor", "NULL"), c(1,6)))

Is exactly what I needed.

> -----Original Message-----
> From: Duncan Murdoch [mailto:murdoch_at_stats.uwo.ca]
> Sent: Friday, May 30, 2008 9:25 AM
> To: Doran, Harold
> Cc: R-help_at_r-project.org
> Subject: Re: [R] Skipping columns to save memory
>
> 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
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 02 Jun 2008 - 02:19:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 02:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive