Skip to content

group_by() for epi_archive objects #64

Closed
@ryantibs

Description

@ryantibs

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 object x to do:
     x %>% group_by(geo_value) %>% epix_slide(col = my_fun(...))
    
    to do a sliding computation grouped by geo_value. This would be precisely analogous to how we would do it on an epi_df object with epi_slide(). Currently we have to set the grouping variables as an argument to epix_slide().

Cons:

  • After calling epix_slide(), the object x above would still be grouped. This is because R6 objects obey reference semantics. So we'd have to ungroup() it, which may be a bit counterintuitive since it's not how dplyr verbs work on data frames or tibbles.

@lcbrooks @dajmcdon @jacobbien What do you guys think?

Metadata

Metadata

Assignees

Labels

P0high priorityop-semanticsOperational semantics; many potentially breaking changes here

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions