当我在 R 中逐行打印向量时cat()
,结果的舍入方式与通常的输出不同:
> dbinom(0:10, 10, 0.95)
[1] 9.765625e-14 1.855469e-11 1.586426e-09 8.037891e-08 2.672599e-06
[6] 6.093525e-05 9.648081e-04 1.047506e-02 7.463480e-02 3.151247e-01
[11] 5.987369e-01
> options(scipen=999)
> dbinom(0:10, 10, 0.95)
[1] 0.00000000000009765625 0.00000000001855468750 0.00000000158642578125
[4] 0.00000008037890625000 0.00000267259863281252 0.00006093524882812524
[7] 0.00096480810644531680 0.01047505944140628489 0.07463479852001964066
[10] 0.31512470486230492739 0.59873693923837867370
> cat(dbinom(0:10, 10, 0.95), sep = "\n")
0.00000000000009765625
0.00000000001855469
0.000000001586426
0.00000008037891
0.000002672599
0.00006093525
0.0009648081
0.01047506
0.0746348
0.3151247
0.5987369
如何保留小数位?