John
John

Reputation: 1828

Problems with dplyr summarise function of the latest R version

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

The following is session information:

> 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  

Upvotes: 4

Views: 1480

Answers (2)

Tim Tan
Tim Tan

Reputation: 33

Seems to be a tidyverse/dplyr issue for unbound values if you are using R 4.0. Probably updating the dplyr package to 0.8.5 or later may help? Refer to below

https://github.com/tidyverse/dplyr/pull/4928

Upvotes: 3

user13653858
user13653858

Reputation:

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.

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

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

Upvotes: 4

Related Questions