Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lifecycle::last_lifecycle_warnings() seems incompatible with dplyr warning handler #6952

Open
DavisVaughan opened this issue Nov 3, 2023 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@DavisVaughan
Copy link
Member

i.e. it tells you to run the lifecycle function, but there is no warning there:

library(dplyr, warn.conflicts = FALSE)
rlang::local_interactive()

df <- tibble(x = 1)

mutate(df, across(x, mean, na.rm = TRUE))
#> Warning: There was 1 warning in `mutate()`.
#> ℹ In argument: `across(x, mean, na.rm = TRUE)`.
#> Caused by warning:
#> ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
#> Supply arguments directly to `.fns` through an anonymous function instead.
#> 
#>   # Previously
#>   across(a:b, mean, na.rm = TRUE)
#> 
#>   # Now
#>   across(a:b, \(x) mean(x, na.rm = TRUE))
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> # A tibble: 1 × 1
#>       x
#>   <dbl>
#> 1     1

lifecycle::last_lifecycle_warnings()
#> list()

dplyr::last_dplyr_warnings()
#> [[1]]
#> <warning/rlang_warning>
#> Warning in `mutate()`:
#> ℹ In argument: `across(x, mean, na.rm = TRUE)`.
#> Caused by warning:
#> ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
#> Supply arguments directly to `.fns` through an anonymous function instead.
#> 
#>   # Previously
#>   across(a:b, mean, na.rm = TRUE)
#> 
#>   # Now
#>   across(a:b, \(x) mean(x, na.rm = TRUE))
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
#> ---
#> Backtrace:
#>     ▆
#>  1. ├─dplyr::mutate(df, across(x, mean, na.rm = TRUE))
#>  2. ├─dplyr:::mutate.data.frame(df, across(x, mean, na.rm = TRUE)) at dplyr/R/mutate.R:146:3
#>  3. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) at dplyr/R/mutate.R:181:3
#>  4. │   ├─base::withCallingHandlers(...) at dplyr/R/mutate.R:268:3
#>  5. │   └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) at dplyr/R/mutate.R:273:7
#>  6. │     └─mask$eval_all_mutate(quo) at dplyr/R/mutate.R:380:9
#>  7. │       └─dplyr (local) eval() at dplyr/R/data-mask.R:94:7
#>  8. └─dplyr::across(x, mean, na.rm = TRUE)

Created on 2023-11-03 with reprex v2.0.2

@DavisVaughan DavisVaughan added the bug an unexpected problem or unintended behavior label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant