简体   繁体   English

R:获取 dplyr 和摘要以显示超过 3 位

[英]R: Getting dplyr & summary to show more than 3 digits

This fails.这失败了。 I need 3 digits to the right of the decimal point.我需要小数点右边的 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. 

I also tried我也试过

options(pillar.sigfigs=10)

I'm looking for a one line answer.我正在寻找一个单行的答案。 What do I replace the digits setting above with?我用什么替换上面的数字设置?

Thanks for any help.谢谢你的帮助。

The problem was the reference I used said to use问题是我曾经说过要使用的参考

options(pillar.sigfigs=7)

When you need to use当你需要使用

options(pillar.sigfig=7)

and that R doesn't give you an error saying that it doesn't know what pillar.sigfigs means.并且 R 不会给你一个错误,说它不知道pillar.sigfigs是什么意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM