Correcting “summary” in R with appropriate # of digits of precision

后端 未结 1 730
心在旅途
心在旅途 2020-12-16 12:52

A simple question on a simple seemingly innocent function: summary.

Until I saw results for Min and Max that were ou

1条回答
  •  萌比男神i
    2020-12-16 13:40

    The default for summary.data.frame is not digits=3, but rather:

       ... max(3, getOption("digits") - 3)  # set in the argument list
    getOption("digits")    # the default setting
    [1] 7
    options(digits=10)
    > summary(df)
           V1                    V2                 V3              
     Min.   :-3.70323584   Min.   :    11.0   Min.   :6.790622e-05  
     1st Qu.:-0.66847105   1st Qu.:122798.5   1st Qu.:2.497735e-01  
     Median : 0.00977831   Median :247971.0   Median :5.013797e-01  
     Mean   : 0.01044752   Mean   :248776.4   Mean   :5.001182e-01  
     3rd Qu.: 0.68878422   3rd Qu.:374031.0   3rd Qu.:7.502424e-01  
     Max.   : 3.56810079   Max.   :499931.0   Max.   :9.998686e-01  
    

    0 讨论(0)
提交回复
热议问题