[R] write.table decimal digits

Albert Vilella avilella at gmail.com
Tue Jun 20 16:13:02 CEST 2006

Hi all,

I have a table with values that I rounded with:

mytable = round(mytable, digits=2)

and when I use write.table:

write.table(mytable, file = "/home/user/mytable.txt", sep = " ",
row.names=TRUE, col.names=TRUE, quote=FALSE)

the values are printed like "1" instead of "1.00" (which would make the
table well-arranged vertically).

How can I force write.table to write the values with two-digited
decimals for all the fields?

Thanks in advance,


More information about the R-help mailing list