-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
planning 🌱Development planningDevelopment planning
Description
It's cumbersome to remember (and repeat) the grouping conditions that are required in order to complete zero-count groups when using count_fcds(). The complete_age_groups() function is correctly named but may be overly specific, especially in relation to the task at hand.
fcds %>%
filter(cancer_site_group == "Cervix Uteri") %>%
filter(sex == "Female") %>%
filter_age_groups(age_gt = 20) %>%
filter(county_name %in% fcds_const("moffitt_catchment")) %>%
count_fcds(race = TRUE, county_name, cancer_site_group) %>%
complete_age_groups(
# required to know which age groups need to be completed
age_gt = 20,
# Need to know the structure of the columns that need to be completed
sex, race, county_name, cancer_site_group,
# Here's the tricky part: year_group and year vary together
nesting(year_group, year)
)This is the very flexible workflow that ensures that any request can be completed. But it's also fairly common and can be abstracted into a single, one-shot function filter_count_fcds().
fcds %>%
filter_count_fcds(
# Filters ....
cancer_site_group == "Cervix Uteri",
sex == "Female",
county_name %in% fcds_const("moffitt_catchment"),
# Arguments ....
age_gt = 20,
groups = c(race)
)- Arguments included in the filters are automatically included in groups.
- The
groupsargument allows counts broken down by additional columns across all values in that column. c("year_group", "year", "age_group")are still the default groups- The default column structure when using just the FCDS data can be inferred from columns present in filters and groups. If unknown columns found then the function can bail early and recommend the manual workflow.
vickyliao92
Metadata
Metadata
Assignees
Labels
planning 🌱Development planningDevelopment planning