Skip to content
Prev 248369 / 398502 Next

write.table -- maintain decimal places

Thank you for the response, Peter.  

The approach:
write.table(format(df, drop0trailing=FALSE),file='df.txt',quote=F,sep='\t',row.names=F)
surprisingly still results in some loss of trailing 0's.

df:
   EFFECT2  PVALUE
1 0.023    0.88080
2 -0.260  0.08641
3 -0.114  0.45200

df.txt:
EFFECT2    PVALUE
0.023      8.808e-01
-0.26      8.641e-02
-0.114     4.520e-01


-----Original Message-----
From: Peter Ehlers [mailto:ehlers at ucalgary.ca] 
Sent: Tuesday, January 25, 2011 5:09 PM
To: Jim Moon
Cc: r-help at r-project.org
Subject: Re: [R] write.table -- maintain decimal places
On 2011-01-25 16:16, Jim Moon wrote:
write.table(format(df, drop0trailing=FALSE), ....)

Peter Ehlers