【问题标题】:R: Getting dplyr & summary to show more than 3 digitsR:让 dplyr 和摘要显示超过 3 位数字
【发布时间】:2020-12-05 10:08:15
【问题描述】:

这失败了。我需要小数点右边 3 位数字。

require("dplyr")
options(digits = 10)
group_by(MyData, Type_1, Type_2) %>%
  summarise(
  count = n(),
  mean = mean(Rate, na.rm = TRUE),
  sd = sd(Rate, na.rm = TRUE)
)

# A tibble: 4 x 5
# Groups:   Type_1 [2]
  Type_1  Type_2 count  mean    sd
  <fct>  <fct> <int> <dbl> <dbl>
1 A      X        8  1203. 120. 
2 A      Y        8  1324. 99.1
3 B      X        8  1162. 106. 
4 B      Y        8  1639. 118. 

我也试过

options(pillar.sigfigs=10)

我正在寻找一个单行的答案。我用什么替换上面的数字设置?

感谢您的帮助。

【问题讨论】:

标签: r dplyr summarize significant-digits


【解决方案1】:

问题是我曾经说过要使用的参考

options(pillar.sigfigs=7)

当你需要使用时

options(pillar.sigfig=7)

并且 R 不会给你一个错误,说它不知道 pillar.sigfigs 是什么意思。

【讨论】:

猜你喜欢
  • 2015-07-09
  • 1970-01-01
  • 1970-01-01
  • 2021-05-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多