Add function to read and manipulate the population lookups#2
Closed
Moohan wants to merge 23 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new function get_pop_est() to retrieve and manipulate population estimate lookups with flexible filtering and reshaping options.
- Implements
get_pop_est()function with support for different geographic levels, year filtering, age grouping, and data pivoting - Updates project configuration to use native pipe operator
- Adds necessary package dependencies (janitor, phsmethods, tidyr)
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| R/get_pop_est.R | New function implementation with comprehensive parameter validation and data transformation logic |
| man/get_pop_est.Rd | Generated documentation with detailed examples and parameter descriptions |
| R/find_latest_file.R | Enhanced to accept additional arguments for fs::dir_info() |
| DESCRIPTION | Added new dependencies and version bump to development |
| NAMESPACE | Exported the new function |
| NEWS.md | Updated changelog with new feature |
| phslookups.Rproj | Enabled native pipe operator |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Full refactor to make IZ and DZ work properly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A handful of new functions for retrieving the population estimate files work like the others in that you can do:
get_hb_pop_est() get_hscp_pop_est() # etcIt will return the relevant populations file in a consistent long format as default, which is how the HB/HSCP/CA files are stored on disk but not how the DZ/IZ files are.
There is other optional functionality:
phsmethods::create_age_groups()to create age groups so they can be customised using that function's parameters. The data will be returned aggregated to the age groups.