Skip to content
Prev 132332 / 398506 Next

read.table() and precision?

On Mon, 17 Dec 2007, Moshe Olshansky wrote:

            
Using save/load is the simplest.  Don't worry about finding better 
solutions until you know those are not good enough.  (serialize / 
unserialize is another interface to the same underlying idea.)
Do please read the help before making false claims. ?write.table says

      Real and complex numbers are written to the maximal possible
      precision.

OTOH, ?write says it is a wrapper for cat, whose help says

      'cat' converts numeric/complex elements in the same way as 'print'
      (and not in the same way as 'as.character' which is used by the S
      equivalent), so 'options' '"digits"' and '"scipen"' are relevant.
      However, it uses the minimum field width necessary for each
      element, rather than the same field width for all elements.

so this hints as.character() might be a useful preprocessor.
See ?writeBin.  save/load by default write binary files, but use of 
writeBin can be faster (and less flexible).
Somehow you have missed a great deal of information about R I/O.
Try help.start() and reading the sections the search engine shows you 
that look relevant.