【发布时间】:2020-10-15 22:05:45
【问题描述】:
我们都知道,我们可以计算任何对向量进行运算并以 R 为基数返回单个值的摘要。 我想问一下,为什么当我尝试使用在summarize 中返回多个值函数的分位数时没有报错?
heights %>%
filter(sex == "Male") %>%
summarize(range = quantile(height, c(0, 0.5, 1)))
结果不是错误:
range
1 50.00000
2 69.00000
3 82.67717
【问题讨论】:
-
dplyr 1.0.0允许summarize()返回长度大于 1 的向量,请参阅 tidyverse.org/blog/2020/03/dplyr-1-0-0-summarise。 -
以
summarise的documentation为例,dplyr 1.0.0允许汇总为多个值 -
我知道了,谢谢!