dplyr的问题总结了最新R版本的功能 [英] Problems with dplyr summarise function of the latest R version

查看:129
本文介绍了dplyr的问题总结了最新R版本的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我以前的R版本中从未发生过的事情。

The following never happen in my previous R version.

mtcars %>% dplyr::group_by(carb) %>% dplyr::summarise(N=sum(am==1))
Error in summarise_impl(.data, dots, environment(), caller_env()) : 
  attempt to bind a variable to R_UnboundValue

以下是会话信息:

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS:   /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] DT_0.11         glue_1.3.1      reshape2_1.4.3  DBI_1.1.0       plotly_4.9.1    ggplot2_3.2.1   lubridate_1.7.4 dplyr_0.8.4    
 [9] shinyjs_1.1     shiny_1.4.0     odbc_1.2.2     

loaded via a namespace (and not attached):
 [1] tidyselect_1.0.0  purrr_0.3.3       colorspace_1.4-1  vctrs_0.2.2       htmltools_0.4.0   viridisLite_0.3.0 yaml_2.2.1       
 [8] utf8_1.1.4        blob_1.2.1        rlang_0.4.4       later_1.0.0       pillar_1.4.3      withr_2.1.2       bit64_0.9-7      
[15] lifecycle_0.1.0   plyr_1.8.5        stringr_1.4.0     munsell_0.5.0     gtable_0.3.0      htmlwidgets_1.5.1 fastmap_1.0.1    
[22] httpuv_1.5.2      crosstalk_1.0.0   fansi_0.4.1       Rcpp_1.0.3        xtable_1.8-4      promises_1.1.0    scales_1.1.0     
[29] jsonlite_1.6.1    mime_0.8          bit_1.1-15.1      hms_0.5.3         digest_0.6.23     stringi_1.4.5     grid_4.0.0       
[36] cli_2.0.1         tools_4.0.0       magrittr_1.5      lazyeval_0.2.2    tibble_2.1.3      crayon_1.3.4      tidyr_1.0.2      
[43] pkgconfig_2.0.3   rsconnect_0.8.16  data.table_1.12.8 assertthat_0.2.1  httr_1.4.1        rstudioapi_0.10   R6_2.4.1         
[50] compiler_4.0.0  


推荐答案

这可能是较旧的 dplyr 包的问题:似乎 R_UnboundValue 已从 dplyr 1.0.0 中删除​​,因为它不属于官方R API的一部分。

It may be a problem of older dplyr package: it seems that R_UnboundValue has been removed in dplyr 1.0.0 because not beeing part of the official R API.

因此,请尝试将 dplyr 软件包从 0.8.4 更新为 1.0 .0 (或降级您的R)。相关的GitHub PR: https://github.com/tidyverse/dplyr/pull/4592

So try to update your dplyr package from 0.8.4 to 1.0.0 (or downgrade your R). Related GitHub PR: https://github.com/tidyverse/dplyr/pull/4592

R 4.0.0 中,dplyr 1.0.0 您的代码似乎正常工作。

In R 4.0.0 with dplyr 1.0.0 your code seems to work properly.

这篇关于dplyr的问题总结了最新R版本的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆