dplyr functions (including summarise()
and mutate()
, among others) now have an argument, .by
, which allows for per-operation grouping, removing the need for group_by()
in simple pipelines. It'd be nice for ww_multi_scale()
to support the same (for the sf method; raster methods don't support grouping, and probably never will), such that these calls were equivalent:
ww_multi_scale(
dplyr::group_by(ames_sf, Neighborhood),
Sale_Price,
predictions,
n = list(
c(10, 10),
c(1, 1)
),
square = FALSE
)
ww_multi_scale(
ames_sf,
Sale_Price,
predictions,
n = list(
c(10, 10),
c(1, 1)
),
square = FALSE,
.by = Neighborhood
)
For what it's worth, note that dplyr errors when trying to mix group_by()
and .by
:
> dplyr::group_by(iris, Species) |> dplyr::summarise(m = mean(Sepal.Length), .by = Species)
Error in `dplyr::summarise()`:
! Can't supply `.by` when `.data` is a grouped data frame.
Run `rlang::last_trace()` to see where the error occurred.