|
X<-as.data.frame(matrix(rnorm(10*3),nrow=10))
write.table(format(X,digits=7),file="myfile.txt",quote=FALSE)
在myfile.txt 数据呈现如此:
V1 V2 V3
1 1.6961655 -0.4700603 0.5298445
2 1.5268508 1.1891110 0.2270164
3 -0.5698944 -1.1921687 -0.3072627
4 1.0450445 1.3774005 -1.4995858
5 0.4265215 0.5279158 0.1744699
6 1.5516925 -1.0503520 0.2978492
7 -0.8460928 0.3894618 0.7666396
8 0.1505810 0.2777488 -0.9364641
9 -0.8282284 -0.7832542 1.4818762
10 0.2677572 -1.2915542 0.4994488
对format 用法,详细参考 它说明书!!help(format)
|