1

我开始使用包并且在数字输出格式DescTools方面遇到了一些麻烦。Desc()

所有结果都以科学记数法提供,我发现它不太容易阅读。

使用摘要标准功能,我没有这种行为

一个简短的例子:

set.seed(1)
w <- data.frame(norm.var = as.numeric(rnorm(n = 1000, mean = 100, sd = 30)))

head(w)
   norm.var
1  81.20639
2 105.50930
. .........

summary(w$norm.var)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  9.759  79.080  98.940  99.650 120.700 214.300 

Desc(x = w$norm.var)
-------------------------------------------------------------------------------------------------------------------- 
w$norm.var (numeric)

         length              n            NAs         unique             0s           mean         meanSE
          1e+03          1e+03              0            = n              0   9.965056e+01   9.818074e-01
            .05            .10            .25         median            .75            .90            .95
   4.819120e+01   5.981999e+01   7.907880e+01   9.894027e+01   1.206528e+02   1.397209e+02   1.523195e+02
          range             sd          vcoef            mad            IQR           skew           kurt
   2.045498e+02   3.104748e+01   3.115635e-01   3.095060e+01   4.157404e+01  -1.913836e-02  -7.768915e-03

lowest : 9.758542e+00, 1.009152e+01, 1.180679e+01, 1.333238e+01, 2.211666e+01
highest: 1.749298e+02, 1.794750e+02, 1.802722e+02, 1.916723e+02, 2.143083e+02

我的相关会话信息是:

> sessionInfo()

R version 3.1.2 (2014-10-31)

Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252    LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C                   LC_TIME=Italian_Italy.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] DescTools_0.99.13   manipulate_1.0.1    itertools_0.1-3     iterators_1.0.7     foreach_1.4.2      
 [6] randomForest_4.6-12 scales_0.2.4        ggplot2_1.0.0       XLConnect_0.2-10    XLConnectJars_0.2-9
[11] reshape_0.8.5       plyr_1.8.1         

loaded via a namespace (and not attached):
 [1] boot_1.3-14      codetools_0.2-10 colorspace_1.2-4 digest_0.6.8     foreign_0.8-62   grid_3.1.2      
 [7] gtable_0.1.2     labeling_0.3     MASS_7.3-37      munsell_0.4.2    mvtnorm_1.0-2    parallel_3.1.2  
[13] proto_0.3-10     Rcpp_0.12.1      reshape2_1.4.1   rJava_0.9-6      stringr_0.6.2    tools_3.1.2  

谢谢你的帮助

4

1 回答 1

4

尝试options(scipen=1000)全局关闭科学记数法

options(scipen=1000)
Desc(w)

您可能还想考虑options(digits=3)报告之类的东西。


'data.frame':   1000 obs. of  1 variable:
 1 $ norm.var: num  81.2 105.5 74.9 147.9 109.9 ...

------------------------------------------------------------------------------ 
1 - norm.var (numeric)

      length           n         NAs      unique          0s        mean      meanSE
       1'000       1'000           0         = n           0   99.650556    0.981807

         .05         .10         .25      median         .75         .90         .95
   48.191200   59.819990   79.078803   98.940273  120.652839  139.720893  152.319495

       range          sd       vcoef         mad         IQR        skew        kurt
  204.549758   31.047475    0.311563   30.950601   41.574035   -0.019138   -0.007769

lowest : 9.758542, 10.091521, 11.806789, 13.33238, 22.116658
highest: 174.929848, 179.475006, 180.272224, 191.672271, 214.3083
于 2015-10-10T16:58:39.490 回答