我想在其中使用该across()
功能,dplyr
但出现错误。例如,运行
iris %>%
group_by(Species) %>%
summarise(across(starts_with("Sepal"), mean))
给我
Error in across(starts_with("Sepal"), mean) :
could not find function "across"
across()
是最近的介绍https://towardsdatascience.com/what-you-need-to-know-about-the-new-dplyr-1-0-0-7eaaaf6d78ac in dplyr
。但是,包dplyr
已更新并加载
packageVersion('dplyr')
[1] ‘1.0.0’
检查内部dplyr
ls("package:dplyr")
[1] "%>%" "add_count" "add_count_" "add_row" "add_rownames" "add_tally"
[7] "add_tally_" "all_equal" "all_vars" "anti_join" "any_vars" "arrange"
[13] "arrange_" "arrange_all" "arrange_at" "arrange_if" "as_data_frame" "as_label"
我发现它across
不存在,但是如果我在帮助程序中查找该功能,?across
我会得到解释across
.
怎么去across
上班?
- - - 编辑 - - -
我sessionInfo()
的如下:
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyselect_1.1.0 dplyr_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 cellranger_1.1.0 pillar_1.4.2 compiler_3.6.1 forcats_0.4.0 tools_3.6.1 jsonlite_1.6 lubridate_1.7.4 lifecycle_0.2.0
[10] tibble_2.1.3 nlme_3.1-140 gtable_0.3.0 lattice_0.20-38 pkgconfig_2.0.3 rlang_0.4.6 cli_1.1.0 rstudioapi_0.10 haven_2.1.1
[19] xml2_1.2.2 httr_1.4.1 stringr_1.4.0 generics_0.0.2 vctrs_0.3.1 hms_0.5.1 grid_3.6.1 glue_1.4.1 R6_2.4.0
[28] fansi_0.4.0 readxl_1.3.1 readr_1.3.1 modelr_0.1.5 tidyr_1.0.0 purrr_0.3.3 ggplot2_3.2.1 magrittr_1.5 backports_1.1.4
[37] scales_1.0.0 rvest_0.3.4 assertthat_0.2.1 tidyverse_1.2.1 colorspace_1.4-1 utf8_1.1.4 stringi_1.4.3 lazyeval_0.2.2 munsell_0.5.0
[46] broom_0.5.2 crayon_1.3.4
> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"