25162

Problems with dplyr summarise function of the latest R version

<h3>Question</h3>

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
<h3>Answer1:</h3>

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.


<h3>Answer2:</h3>

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

来源:https://stackoverflow.com/questions/62340269/problems-with-dplyr-summarise-function-of-the-latest-r-version

Recommend

  • Fatal error: Unable to open the base package [closed]
  • R xmlParse/xmlTreeParse unknown IO error
  • R lme4 Error in '/usr/lib/rstudio/bin/rsession' : malloc(): memory corruption:
  • PHP setlocale doesn't work
  • HTML5 Elements and HTML Structuring/Sectioning
  • Calling OnPaintBackground
  • Controlling the behavior of the Browsers Back Button
  • System.Runtime.InteropServices.COMException (0x800A1436)
  • How to fetch Salesforce Attachment file content with django-salesforce?
  • Material Transitions in pre lollipop apps
  • Creating unique id for textbox
  • ZKemKeeper: Events not triggering
  • What exactly does lowering the priority of a constraint do?
  • How to enable FEDERATED engine in XAMPP
  • creating buttons in skview to point to different scenes
  • Elmah Does not email in a fire and forget scenario
  • pip installation of gmpy2
  • SherlockActivity cannot be resolved to a type in android
  • TypeError: object is not a function showing at express
  • Ways to determine returning “anonymous” guests in PHP
  • How to change footer of a particular page with a particular header title in TCPDF
  • Saved Core Data does not persist after app closes 80% of the time
  • HTTPS request/response in Android
  • In an Outlook addin, how to check whether we are in compose mode or read mode?
  • Show QMainwindow in the middle of the screen
  • REGEXP_REPLACE pattern has to be const? Comparing strings in BigQuery
  • Old data appears in SQLite database when reinstalling app
  • How to create 2 svg's on one page?
  • How to change WebBrowser fullscreen video mode?
  • AppEngine Paypal integration giving SSLCertificateError on localhost, using Python
  • Windows 8 Flexboxes - Nesting Flexboxes with overflow enabled
  • device tree overlay phandle