The behaviour reported with regards to tidyselect-type variables in #518 seems to persist for masking types. (Likely related: #525; #534)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
con <- DBI::dbConnect(RSQLite::SQLite(), dbname = ":memory:")
copy_to(con, nycflights13::flights, "flights",
temporary = FALSE,
indexes = list(
c("year", "month", "day"),
"carrier",
"tailnum",
"dest"
)
)
flights_db <- tbl(con, "flights")
group_cols <- c("year", "month")
# Desired result
nycflights13::flights %>%
group_by(across(all_of(group_cols))) %>%
summarise(NumFlights = n(),
MeanDist = mean(distance)
)
#> `summarise()` regrouping output by 'year' (override with `.groups` argument)
#> # A tibble: 12 x 4
#> # Groups: year [1]
#> year month NumFlights MeanDist
#> <int> <int> <int> <dbl>
#> 1 2013 1 27004 1007.
#> 2 2013 2 24951 1001.
#> 3 2013 3 28834 1012.
#> 4 2013 4 28330 1039.
#> 5 2013 5 28796 1041.
#> 6 2013 6 28243 1057.
#> 7 2013 7 29425 1059.
#> 8 2013 8 29327 1062.
#> 9 2013 9 27574 1041.
#> 10 2013 10 28889 1039.
#> 11 2013 11 27268 1050.
#> 12 2013 12 28135 1065.
# Fails with db connection
flights_db %>%
group_by(across(all_of(group_cols))) %>%
summarise(NumFlights = n(),
MeanDist = mean(distance)
)
#> Error: Unsupported `.fns` for dbplyr::across()
The behaviour reported with regards to tidyselect-type variables in #518 seems to persist for masking types. (Likely related: #525; #534)