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:[EMAIL PROTECTED] > Sent: Friday, May 30, 2008 9:25 AM > To: Doran, Harold > Cc: R-help@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@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.