[R] sort of fread to read from a file at fixed positions?

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Mar 14 10:04:31 CET 2006


See ?read.fwf, and also the `R Data Import/Export Manual' that ships with 
every copy of R.

Also, you can do in R in the way you describe for Octave with connections 
and readChar (again, see the manual).


On Tue, 14 Mar 2006, Gael de Lannoy wrote:

> Hello everybody,
>
> I need to read a file with a header (EDF files, recorded
> electroencephalogram signals) that has fixed byte positions for each
> field of its header.
> These fields have no separator between them, for example:
>
> <8 ascii name of the patient><10ascii start time of the recording><4
> ascii ... > etc.
>
> I read that perfectly in Octave by using fread, fseek and other
> C-derived file access methods, but i dont see such a method being
> avalaible in R? I read the scan help page but it doesn't seem to be able
> to read x chars then from that position read another y chars then jump
> at position 80 and read z chars etc.
>
> Thanks in advance,
>
> Gael de Lannoy.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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