[R] read.fwf and header

Martin Maechler maechler at stat.math.ethz.ch
Sat Nov 4 12:14:07 CET 2006


>>>>> "FrPi" == François Pinard <pinard at iro.umontreal.ca>
>>>>>     on Wed, 1 Nov 2006 20:21:11 -0500 writes:

    FrPi> [Martin Maechler]
    >> In my (and probably R-core's) view, read.fwf() should only have
    >> to be used for ``legacy data files'' (those times when people used *no*
    >> separators in order to save disk space), since nowadays, such
    >> data files should "automatically" have correct separators. 

    FrPi> In my day-to-day experience, the main virtue for fixed width format 
    FrPi> files is basic, humble legibility, much more than disk space savings.  
Good point.  For this reason, I often prefer  <tab>-delimited data files
which are human readable too (and don't need quoting of strings,
typically).  But also, the read.table() default <white space>-separated files
are very well humanly readable if the column starts are
aligned. You do need to quote ("..") strings with embedded white
space then, but that is very well
human-readable if you have a smart editor (such as Emacs ;-)
which then automatically colorizes strings differently than the
rest of the file entries.

However, I think this (human-readibility) only
applies to relatively small files.


    FrPi> The FWF files I see have delimiters between fields,
    FrPi> but also embedded space within fields, or at end of
    FrPi> fields, without extraneous quotes.  XML markup, CSVs,
    FrPi> quoted fields, etc. are devices meant for helping
    FrPi> machines much more than for helping humans.  They
    FrPi> significantly decrease legibility.  Humans not only
    FrPi> know better, they decipher fixed width format easily
    FrPi> enough for not really needing hairier devices in
    FrPi> general.

    FrPi> FWF files may be archaic, they are not obsolescent.
    FrPi> They will resist the fashion of the day for
    FrPi> complexity, and survive in the long run.

I cannot really oppose this statement, 
but am not as sure as you seem  ;-)

Thanks anyway for the thought provoking reply.
With regards,
Martin



More information about the R-help mailing list