[R] how to specify format of floats for the output file

ping-yin@uiowa.edu ping-yin at uiowa.edu
Thu Aug 21 22:56:16 CEST 2003


I'd like to write some numbers to an external file that looks "pretty" (e.g,
decimal points aligned, same number of decimals). For example, if using
sprintf(), "%5.1f" can be used to specify the format of the float to be printed
on screen. How can I do the same if I want to write an output file instead? I
have tried cat  and write.table, but none of them worked so far. 

Thanks in advance,

Ping




More information about the R-help mailing list