4141# '
4242# ' # Age Groups with Custom Settings:
4343# ' # Aggregate into 5-year age groups, with an open-ended final group "85+"
44- # ' get_pop_est("hb", age_groups = TRUE, by = 5, to = "85+" )
44+ # ' get_pop_est("hb", age_groups = TRUE, by = 5, to = 85 )
4545# '
4646# ' # Pivot Wider (All): CA Population Estimates, Reshaped by Sex and Age Group
4747# ' # The result will have columns for each combination of sex and age group,
@@ -100,7 +100,7 @@ get_pop_est <- function(
100100 {.file {fs::path_file(pop_path)}} file."
101101 )
102102 }
103- pop_est <- pop_est [ pop_est $ year > = min_year , ]
103+ pop_est <- dplyr :: filter( pop_est , .data $ year > = min_year )
104104 }
105105
106106 if (! is.null(max_year )) {
@@ -111,18 +111,18 @@ get_pop_est <- function(
111111 {.file {fs::path_file(pop_path)}} file."
112112 )
113113 }
114- pop_est <- pop_est [ pop_est $ year < = max_year , ]
114+ pop_est <- dplyr :: filter( pop_est , .data $ year < = max_year )
115115 }
116116
117117 # Create age groups
118118 if (age_groups ) {
119119 pop_est <- pop_est | >
120120 dplyr :: mutate(
121- age_group = phsmethods :: create_age_groups(x = age , ... ),
121+ age_group = phsmethods :: create_age_groups(x = .data $ age , ... ),
122122 .keep = " unused"
123123 ) | >
124- dplyr :: group_by(dplyr :: across(! pop )) | >
125- dplyr :: summarise(pop = sum(pop ), .groups = " drop" )
124+ dplyr :: group_by(dplyr :: across(! .data $ pop )) | >
125+ dplyr :: summarise(pop = sum(.data $ pop ), .groups = " drop" )
126126 }
127127
128128 # Pivot data
0 commit comments