Skip to content

Commit

Permalink
Fix some minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Moohan committed Jun 25, 2024
1 parent 5447061 commit c09ddff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions R/get_pop_est.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion man/get_pop_est.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c09ddff

Please # to comment.