-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a population dataset #95
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
43b4c43
Added a population dataset
jacgrout 0af8bd0
Merge branch 'nhs-r-community:main' into main
jacgrout 18eb0be
Ran documentation
jacgrout 44ba266
Updated filepath
jacgrout 16d0146
Fix comments
jacgrout 74722ee
Replace example and update documentation
jacgrout 1479282
Added source of dataset and executed styler
jacgrout ef766fc
Updated documentation
Lextuga007 a00500a
Added code to create rda file
Lextuga007 ca7b819
Corrected item mistakenly listed as href and replaced href with url
Lextuga007 a47a03e
Moved url reference as double brackets result in a note
Lextuga007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#' ONS Mid-2023 Population Estimate for UK | ||
#' | ||
#' ONS Population Estimates for Mid-year 2023 | ||
#' National and subnational mid-year population estimates for the UK and its | ||
#' constituent countries by administrative area, age and sex (including | ||
#' components of population change, median age and population density). | ||
#' | ||
#' Data sourced from | ||
#' \href{https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/populationestimatesforukenglandandwalesscotlandandnorthernireland} | ||
#' | ||
#' @docType data | ||
#' | ||
#' @keywords datasets ons population | ||
#' | ||
#' @format Tibble with six columns | ||
#' \describe{ | ||
#' \item{sex}{male or female} | ||
#' \item{Code}{The country/geography code} | ||
#' \href{Name}{country of the UK} | ||
#' \item{Geography}{Country} | ||
#' \item{age}{year of age} | ||
#' \item{count}{the number of people in this group} | ||
#' } | ||
#' | ||
#' @source \href{https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/populationestimatesforukenglandandwalesscotlandandnorthernireland}{ONS Estimates of the population for the UK, England, Wales, Scotland, and Northern Ireland} | ||
#' | ||
#' @usage data(ons_uk_population_2023) | ||
#' | ||
#' @examples | ||
#' data(ons_uk_population_2023) | ||
#' | ||
#' library(readxl) | ||
#' library(tidyverse) | ||
#' library(tidyr) | ||
|
||
#' Load the data in | ||
#' population_data_2023_f <- read_excel( | ||
#' "C:/Users/jacqueline.grout/Downloads/mye23tablesuk.xlsx", | ||
#' sheet="MYE2 - Females", | ||
#' skip = 7) | ||
|
||
#' population_data_2023_m <- read_excel( | ||
#' "C:/Users/jacqueline.grout/Downloads/mye23tablesuk.xlsx", | ||
#' sheet="MYE2 - Males", | ||
#' skip = 7) | ||
|
||
|
||
#' pivot longer | ||
#' population_data_2023_f <- population_data_2023_f |> | ||
#' select(!`All ages`) |> | ||
#' pivot_longer(`0`:`90+`, names_to = "age", values_to = "count") | ||
|
||
#' population_data_2023_m <- population_data_2023_m |> | ||
#' select(!`All ages`) |> | ||
#' pivot_longer(`0`:`90+`, names_to = "age", values_to = "count") | ||
|
||
#' population_data_combined <- bind_rows( | ||
#' females = population_data_2023_f, | ||
#' males = population_data_2023_m, | ||
#' .id = "sex" | ||
#' ) | ||
#' | ||
#' | ||
#' | ||
"ons_uk_population_2023" |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that line needs to be forced to be a comment: it's trying to run
Load the data in
as an R commandThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, I would remove and change the entire example here:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thats all been fixed just now anyway, but still failing !