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

Probably don't want to drop the grouping in [.epi_df when as_tibble() is used #145

Open
rachlobay opened this issue Jul 15, 2022 · 1 comment
Labels
question Further information is requested

Comments

@rachlobay
Copy link
Collaborator

rachlobay commented Jul 15, 2022

As per [.epi_df, when we subset an epi_df so that the result is not a true epi_df anymore (ex. missing time_value or geo_value), then we return a tibble of the results (refer to around lines 102-104 of methods-epi_df.R). That seems ok, but a problem that arises is that if there is a grouping in the original epi_df, that grouping is lost when we use as_tibble(). This issue showed up in the last two uses of expect_identical() in tests-epi_slide.R. Ex. In

edf %>% group_by(geo_value) %>% epi_slide(f, n=3L, ref_time_values=as.Date("2020-01-01")+200L) %>% 
                     dplyr::select("geo_value","slide_value_value")

the grouping by geo_value is lost when we use dplyr::select("geo_value","slide_value_value").

Currently, we have decided to leave as is, but we may decide in the future that we should change this so the grouping is kept when [.epi_df is used.

Tagged this as a question to keep it open for discussion.

@rachlobay rachlobay changed the title as_tibble() drops the grouping in an [.epi_df Probably don't want to drop the grouping in an [.epi_df when as_tibble() is used Jul 15, 2022
@rachlobay rachlobay added question Further information is requested P2 low priority P3 very low priority and removed P2 low priority P3 very low priority labels Jul 15, 2022
@rachlobay rachlobay changed the title Probably don't want to drop the grouping in an [.epi_df when as_tibble() is used Probably don't want to drop the grouping in [.epi_df when as_tibble() is used Jul 18, 2022
@brookslogan
Copy link
Contributor

Interacts with #223. With the grouped_edf approach, implementing the alternative behavior might be done via implementing some of ?dplyr_extending for grouped_edfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

2 participants