gavinsimpson / gratia

ggplot-based graphics and useful functions for GAMs fitted using the mgcv package
https://gavinsimpson.github.io/gratia/
Other
206 stars 28 forks source link

Returning more (or less) than 1 row per `summarise()` group was deprecated in dplyr 1.1.0. #225

Closed remip48 closed 1 year ago

remip48 commented 1 year ago

Hello,

With the new update of Dplyr, summarise function has changed and can return only one row per group (otherwise returning an error message at the moment (see below) and an error in the future). This is due to the new function reframe, which return here more than one row per group. So gratia::draw(my_model) return a warning with mgcv::gam models now (need to be updated before summarise returns an error).

See new warning: Warning message: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0. ℹ Please use reframe() instead. ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and adjust accordingly. ℹ The deprecated feature was likely used in the gratia package. Please report the issue at https://github.com/gavinsimpson/gratia/issues. This warning is displayed once every 8 hours. Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.

lifecycle::last_lifecycle_warnings() [[1]] <warning/lifecycle_warning_deprecated> Warning: Returning more (or less) than 1 row per summarise() group was deprecated in dplyr 1.1.0. ℹ Please use reframe() instead. ℹ When switching from summarise() to reframe(), remember that reframe() always returns an ungrouped data frame and adjust accordingly. ℹ The deprecated feature was likely used in the gratia package. Please report the issue at https://github.com/gavinsimpson/gratia/issues.

Backtrace: ▆

  1. ├─gratia::draw(modGS)
  2. ├─gratia:::draw.gam(modGS)
  3. │ └─... %>% pluck("rng")
  4. ├─purrr::pluck(., "rng")
  5. │ └─purrr:::pluck_raw(.x, list2(...), .default = .default)
  6. ├─dplyr::summarise(., rng = range(c(data$est, data$lower_ci, data$upper_ci)))
  7. └─dplyr:::summarise.rowwise_df(...)
  8. └─dplyr:::summarise_deprecate_variable_size()

Best regards

gavinsimpson commented 1 year ago

What version of gratia was this issue observed with? I fixed these prior to the dplyr release, so if this is with the current CRAN version or the development version then that would be useful to know.

remip48 commented 1 year ago

Indeed, thank you for your answer and sorry to have raised an issue already solved!

Best