[R] Is it possible to only read a subset by read.table ?

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 12 15:54:07 CEST 2006


On Wed, 12 Jul 2006, David Vonka wrote:

> Hello,
> 
> is it possible to do something like
> 
> DATA <- read.table(file="blabla.dat",subset=(sex=="male")),
> 
> i.e. make R read only a subset of a csv file ?
> I think it would be useful in case of very big datasets,
> but I can't find such a feature.

No.  It is possible to read only some columns: see colClasses.

It is not clear that the ability to skip based on something defined on 
other columns would actually be useful, especially as you can read 
datasets in blocks, process the blocks and combine the results.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list