我刚刚运行了一个统计模型,我希望它使用 stargazer 将模型的结果显示为表格。但是,大数字会完整显示。
fit2<-lm(A~B,data=C)
stargazer(fit2,type="text")
以这张表作为结果
===================================================
Dependent variable:
-------------------------------
A
---------------------------------------------------
B -0.599
(1.698)
32,126,391.000
(24,004,268.000)
---------------------------------------------------
Observations 5
R2 0.040
Adjusted R2 -0.280
Residual Std. Error 31,217,258.000 (df = 3e+00)
F Statistic 0.124 (df = 1e+00; 3e+00)
===================================================
Note: *p<1e-01; **p<5e-02; ***p<1e-02
如何让大数字显示为科学,即:3.12e+07,好吗?我努力了:
options("scipen"=-20,"digit"=2)
fit1<-format(lm(A~B,data=C),scientific=T)
然而,这会导致模型的摘要被扭曲并显示为单行。请问,格式化数字和保留表格结构的最佳方法是什么?
CO NO2 SM
Dec 2004 2.750000e+18 1.985136e+15 0.2187433
Jan 2005 2.980000e+18 2.144211e+15 0.1855678
Feb 2005 2.810000e+18 1.586491e+15 0.1764805
Dec 2005 3.010000e+18 1.755409e+15 0.2307153
Jan 2006 3.370000e+18 2.205888e+15 0.2046671
Feb 2006 3.140000e+18 2.084682e+15 0.1834232
Dec 2006 2.940000e+18 1.824735e+15 0.1837391
Jan 2007 3.200000e+18 2.075785e+15 0.1350665
Feb 2007 3.060000e+18 1.786481e+15 0.1179924
Dec 2007 2.750000e+18 1.645800e+15 0.2037340
Jan 2008 3.030000e+18 1.973517e+15 0.1515871
Feb 2008 3.040000e+18 1.753803e+15 0.1289968
Dec 2008 2.800000e+18 1.649315e+15 0.1968024
Jan 2009 3.090000e+18 1.856762e+15 0.1630173
Feb 2009 2.880000e+18 1.610011e+15 0.1446938
Dec 2009 2.660000e+18 1.562971e+15 0.1986012
Jan 2010 2.864333e+18 1.733843e+15 0.1559205
Feb 2010 2.881474e+18 1.469982e+15 0.1397536
Dec 2010 2.730000e+18 1.652751e+15 0.2129476
Jan 2011 3.030000e+18 1.862774e+15 0.1681295
Feb 2011 2.850000e+18 1.658988e+15 0.1531579