How to make tibbles display significant digits

北城余情 提交于 2019-12-01 11:11:28

you can set the option pillar.sigfig

options(pillar.sigfig = 1)
as_tibble(iris)
# # A tibble: 150 x 5
#   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#           <dbl>       <dbl>        <dbl>       <dbl> <fct>  
#  1           5.          4.           1.         0.2 setosa 
#  2           5.          3            1.         0.2 setosa 
#  3           5.          3.           1.         0.2 setosa 
#  4           5.          3.           2.         0.2 setosa 
#  5           5           4.           1.         0.2 setosa 
#  6           5.          4.           2.         0.4 setosa 
#  7           5.          3.           1.         0.3 setosa 
#  8           5           3.           2.         0.2 setosa 
#  9           4.          3.           1.         0.2 setosa 
# 10           5.          3.           2.         0.1 setosa 


options(pillar.sigfig = 7)
tb = tibble(x=x)
tb
# # A tibble: 1 x 1
#            x
#        <dbl>
#   1 1234.568

See also:

?`tibble-options`

or online:

https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/tibble-options

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!