# ---- Load ----
library(tidyverse)
library(devtools)
library(readxl)
library(httr)
# Load package
load_all(".")
# ---- England and Wales ----
# Set query url
query_url <-
query_urls |>
filter(id == "census21_england_wales") |>
pull(query)
GET(
query_url,
write_disk(tf <- tempfile(fileext = ".xlsx"))
)
raw_eng_wal <- read_excel(tf, sheet = "P01", skip = 6)
population_england_wales <-
raw_eng_wal |>
# Keep only Local Authority Districts - codes start with E06, E07, E08, E09, and W06
filter(str_detect(`Area code [note 2]`, "^E0|^W0")) |>
select(ltla21_name = `Area name`, ltla21_code = `Area code [note 2]`, population = `All persons`)
# Rename
population21_ltla21 <- population_england_wales
# Save output to data/ folder
usethis::use_data(population21_ltla21, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.