Closed
Description
Should we implement group_by()
as public method in the epi_archive
object? We could do that since it's an R6 object, and when group_by()
is called, we could just have it set a private field called group_keys
to whatever variables are passed.
The only downstream behavior this would affect is the as_of()
and slide()
methods for the epi_archive
object. (These are its own public methods.) This would either return a group epi_df
snapshot, or do a grouped sliding computation, respectively.
Pros:
- Would allow you for an
epi_archive
objectx
to do:to do a sliding computation grouped byx %>% group_by(geo_value) %>% epix_slide(col = my_fun(...))
geo_value
. This would be precisely analogous to how we would do it on anepi_df
object withepi_slide()
. Currently we have to set the grouping variables as an argument toepix_slide()
.
Cons:
- After calling
epix_slide()
, the objectx
above would still be grouped. This is because R6 objects obey reference semantics. So we'd have toungroup()
it, which may be a bit counterintuitive since it's not howdplyr
verbs work on data frames or tibbles.
@lcbrooks @dajmcdon @jacobbien What do you guys think?