[R] skipping columns with read.fwf?

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri May 3 19:06:40 CEST 2002


On Fri, 3 May 2002, Brett A Magill wrote:

> I have a file in fwf.  It is rather large, about 40,000 rows and 40 variables (columns).  I only need about 10 variables form the data set for the analysis at hand.  Unfortunately, these 10 variables are not contiguous in the file, for example, the first is position 1-8, the next position 25-27, then 40.
>
> Is there a way to read the selected varaibles that I need without reading in the entire data set?

No. The first thing read.fwf does is read the whole dataset as a character
vector.  It's not designed for large files, but it may well read all the
vars in your problem if you have enough memory: the file only seems to be
of the order of 20Mb.

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list