From a2f14a9e343e57f6985b61de2fccaa51f7c7a138 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Thu, 20 Jun 2024 18:09:23 +0100 Subject: [PATCH] Fix some minor issues --- R/get_pop_est.R | 12 ++++++------ man/get_pop_est.Rd | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/get_pop_est.R b/R/get_pop_est.R index 9e3b387..475b91d 100644 --- a/R/get_pop_est.R +++ b/R/get_pop_est.R @@ -41,7 +41,7 @@ #' #' # Age Groups with Custom Settings: #' # Aggregate into 5-year age groups, with an open-ended final group "85+" -#' get_pop_est("hb", age_groups = TRUE, by = 5, to = "85+") +#' get_pop_est("hb", age_groups = TRUE, by = 5, to = 85) #' #' # Pivot Wider (All): CA Population Estimates, Reshaped by Sex and Age Group #' # The result will have columns for each combination of sex and age group, @@ -100,7 +100,7 @@ get_pop_est <- function( {.file {fs::path_file(pop_path)}} file." ) } - pop_est <- pop_est[pop_est$year >= min_year, ] + pop_est <- dplyr::filter(pop_est, .data$year >= min_year) } if (!is.null(max_year)) { @@ -111,18 +111,18 @@ get_pop_est <- function( {.file {fs::path_file(pop_path)}} file." ) } - pop_est <- pop_est[pop_est$year <= max_year, ] + pop_est <- dplyr::filter(pop_est, .data$year <= max_year) } # Create age groups if (age_groups) { pop_est <- pop_est |> dplyr::mutate( - age_group = phsmethods::create_age_groups(x = age, ...), + age_group = phsmethods::create_age_groups(x = .data$age, ...), .keep = "unused" ) |> - dplyr::group_by(dplyr::across(!pop)) |> - dplyr::summarise(pop = sum(pop), .groups = "drop") + dplyr::group_by(dplyr::across(!.data$pop)) |> + dplyr::summarise(pop = sum(.data$pop), .groups = "drop") } # Pivot data diff --git a/man/get_pop_est.Rd b/man/get_pop_est.Rd index 8395f75..d103fea 100644 --- a/man/get_pop_est.Rd +++ b/man/get_pop_est.Rd @@ -64,7 +64,7 @@ get_pop_est("hb", age_groups = TRUE) # Age Groups with Custom Settings: # Aggregate into 5-year age groups, with an open-ended final group "85+" -get_pop_est("hb", age_groups = TRUE, by = 5, to = "85+") +get_pop_est("hb", age_groups = TRUE, by = 5, to = 85) # Pivot Wider (All): CA Population Estimates, Reshaped by Sex and Age Group # The result will have columns for each combination of sex and age group,