[R] Dropping coloumns while redaing dtaa from text file.

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Mar 10 09:28:22 CET 2005


On Thu, 10 Mar 2005, Upasna Sharma wrote:

> Hi
>
> I have a huge text file and .dat file from which I want to read data. I do
> not need all the columns in the files. I want to extract only some columns
> from the .txt file or the .dat file, because reading the entire file is
> becoming very difficult due to memory issues. Is it possible to extract a
> few columns from .txt or .dat file while reading the data in R?

Yes.

Look at the use of NULL for 'colClasses' (read.table) or 'what' (scan), 
and also 'flush'.

-- 
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