[R] Reading fixed column format

Anupam Tyagi AnupTyagi at yahoo.com
Wed Sep 13 07:48:47 CEST 2006


Barry Rowlingson <B.Rowlingson <at> lancaster.ac.uk> writes:


> > None of these seem to read non-coniguous variables from columns; or 
> > may be I am missing something. "read.fwf" is not meant for large
> > files according to a post in the archives. Thanks for the pointers. I
> > have read the R data input and output. Anupam.
> 
>   First up, how 'large' is your 'large ASCII file'? How many rows and 
> columns?

There are 356,112 records, 326 variables, fixed record length of 1283 positions.
Zipped file is 42MB. There are no field (variable) separaters (delimiters).

>   Secondly, what are 'non-contiguous' variables?

Variables that are not in adjoining positions in the file: reading them from the
file would require skipping columns while reading. For example, below are the
start positions of the first three variables I would like to read.

StartingColumn  VariableName  	FieldLength
1 	STATE 	2
24 	INTVID 	3
30 	PSU 	10


>   Perhaps if you posted the first few lines and columns of the file then 
> we might get an idea of how to read it in.

Because a record (row) of the file is 1283 columns, I would not like to post it
here.

Thank you for your response.

Anupam.



More information about the R-help mailing list