使用我几个月前开发的并且经常使用的脚本,直到最近(〜在过去一周内),我一直面临着dplyr :: summarize_all()引发的特殊错误的问题。以前有没有人遇到过这种情况,并且在潜在的解决方法方面有一些线索?
我尝试删除/重新安装tidyverse和dplyr,只是更新了我的R版本。
library(tidyverse)
# Generate a dataframe
df <- tibble(
year = c(rep(2000, 365), rep(2001, 365)),
day = c(1:730),
temperature = rnorm(730, mean = 10, sd = 3)
)
# summarize() works fine
df %>%
group_by(year, day) %>%
summarize(temp = mean(temperature))
# A tibble: 730 x 3
# Groups: year [2]
year day temp
<dbl> <int> <dbl>
1 2000 1 7.62
2 2000 2 7.08
3 2000 3 10.6
4 2000 4 11.4
5 2000 5 10.1
6 2000 6 7.18
7 2000 7 13.2
8 2000 8 8.64
9 2000 9 9.42
10 2000 10 10.1
# … with 720 more rows
# summarize_all() and summarise_all() do not
df %>%
group_by(year, day) %>%
summarize_all(mean)
Error: not expecting this
Call `rlang::last_error()` to see a backtrace
df %>%
group_by(year, day) %>%
summarise_all(mean)
Error: not expecting this
Call `rlang::last_error()` to see a backtrace
# Relevant session info
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3
[7] tibble_2.1.3 ggplot2_3.1.1 tidyverse_1.2.1