The word 'format' is the clue: please consult the help page for the R
function format().
write.table is designed to write a table to be processed by a program, not
for human consumption. The print() method for data frames calls format().
On Thu, 5 Jan 2006, Yuandan Zhang wrote:
> Hi,
> how to write out data frame in format? for examples, I wrote out a data
> using 'write.table(siredata, file='siredata.txt', row.names=F,
> quote=F)'.
>
> it produced data alike this:
>
>
> 2882 1 0 0 0 0 L1600481991910012 L1600011988880196
> 2883 0.79 0.21 0 0 21 L1622881993930001 L1600481991910012
> 2884 0.84 0.16 0 0 23 L1622881993930005 L1600481991910012
> 2885 0.9 0.1 0 0 23 L1622881993930027 L1600481991910012
> 2886 0.87 0.13 0 0 23 L1622881993930038 L1600481991910012
> 2887 0.9 0.1 0 0 27 L1622881993930111 L1600481991910012
> 2888 0.81 0.19 0 0 22 L1622881993930113 L1600481991910012
>
> In fact i want it formated as
> 2882 1.00 0.00 0.00 0.00 0 L1600481991910012 L1600011988880196
> 2883 0.79 0.21 0.00 0.00 21 L1622881993930001 L1600481991910012
> 2884 0.84 0.16 0.00 0.00 23 L1622881993930005 L1600481991910012
> 2885 0.90 0.10 0.00 0.00 23 L1622881993930027 L1600481991910012
> 2886 0.87 0.13 0.00 0.00 23 L1622881993930038 L1600481991910012
> 2887 0.90 0.10 0.00 0.00 27 L1622881993930111 L1600481991910012
> 2888 0.81 0.19 0.00 0.00 22 L1622881993930113 L1600481991910012
>
> Thanks for your help
>
> Yuandan
>
> ______________________________________________
> 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