[R] Importing ASCII flat

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu May 17 15:43:46 CEST 2012



On 17.05.2012 14:17, Richard Iles wrote:
> I am trying to import Indian National Sample Survey Data. It is ASCII flat
> and an example is below
>
>    001460306025001117101011117111201*01*000000211 270104070204093
> 002460306025001117101011117111201*02*0000008011116104910519572 022  2600
> 1150    30    55   170  4005  003460306025001117101011117111201*03*
> 0000111039204112  222


Do you have a file format specification? This is probably some fixed 
width formatted file, hence read.fwf may help to import the data. See 
?read.fwf and the R Data Import/Export manual.

Best,
Uwe Ligges


> Previous post don't seem to provide much help. I have an document outlining
> the layout of the data, but don't know how to start. An example of the
> layout is that the values in bold indicate separate levels.Example of
> layout is below:
>
>        Sl.No. Item Blk Item Col Len Byte Position Remarks  1 Common Items
>    33 1  - 33 Auto-duplicated  2 Level  2 34  - 35  "02" Generated  3 Filler
> 5 36  - 40 "00000" Generated  4 HHS Size 3 1 2 41  - 42  5 NIC Code(5-digit)
> 3 2 5 43  - 47  6 NCO Code(3-digit) 3 3 3 48  - 50  7 HHS type 3 4 1 51  -
> 51  8 Religion 3 5 1 52  - 52
> As is obvious, I am relatively new to R. Any constructive advice would be
> welcome.
>
> Richard Iles



More information about the R-help mailing list