我有一个csv文件weight.csv
,内容如下。
weight,weight_selfreport
81.5,81.66969147005445
72.6,72.59528130671505
92.9,93.01270417422867
79.4,79.4010889292196
94.6,96.64246823956442
80.2,79.4010889292196
116.2,113.43012704174228
95.4,95.73502722323049
99.5,99.8185117967332
如果我愿意
library(readr)
Df <- read_csv('weight.csv')
Df
我明白了
# A tibble: 9 x 2
weight weight_selfreport
<dbl> <dbl>
1 81.5 81.7
2 72.6 72.6
3 92.9 93.0
4 79.4 79.4
5 94.6 96.6
6 80.2 79.4
7 116. 113.
8 95.4 95.7
9 99.5 99.8
如果我将小标题转换为普通数据帧,则会看到更多数字。
as.data.frame(Df)
weight weight_selfreport
1 81.5 81.66969
2 72.6 72.59528
3 92.9 93.01270
4 79.4 79.40109
5 94.6 96.64247
6 80.2 79.40109
7 116.2 113.43013
8 95.4 95.73503
9 99.5 99.81851
最初,我以为如果要获得这种类型的显示,可以考虑options(pillar.sigfig = 5)
。
但是,事实并非如此。
options(pillar.sigfig = 5)
Df
# A tibble: 9 x 2
weight weight_selfreport
<dbl> <dbl>
1 81.5 81.670
2 72.600 72.595
3 92.9 93.013
4 79.4 79.401
5 94.6 96.642
6 80.2 79.401
7 116.2 113.43
8 95.4 95.735
9 99.5 99.819
所以我看到pillar.sigfig
是关于控制有效数字而不是小数位。
很好,但