From e519b8bcda93d12784cf6c6bde8cde001a527b2b Mon Sep 17 00:00:00 2001 From: Jeremy Kidwell Date: Thu, 12 Oct 2023 09:18:17 +0100 Subject: [PATCH] first commit --- README.md | 1 + nomis.R | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82e0708..4bcbb3f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ You can view a live demo of the textbook book here: [https://kidwellj.github.io/ Recipes included here include: * `nomis.R` Supporting content in chapter 1 which relies on UK census data. This was extracted from the nomis database using R tools * `ordnance_survey.R` Supporting geospatial content in chapter 3 which relies on Ordnance Survey geospatial data +* `openstreetmap_parse.R` Script which can generate extracts from the OpenStreetMap database for content used in chapter 3 # Copyright diff --git a/nomis.R b/nomis.R index 16853c9..fd1e3fd 100644 --- a/nomis.R +++ b/nomis.R @@ -1 +1,25 @@ -nomis.R \ No newline at end of file +# Process to explore nomis() data for specific datasets +library(nomisr) + +# You'll want to start by browsing the nomis dataset towards getting dataset ID (like "NM_529_1" below) +religion_search <- nomis_search(name = "*Religion*") +religion_measures <- nomis_get_metadata("ST104", "measures") +tibble::glimpse(religion_measures) +religion_geography <- nomis_get_metadata("NM_529_1", "geography", "TYPE") + +# grab daata from nomis for 2001 census religion / ethnicity +z0 <- nomis_get_data(id = "NM_1872_1", time = "latest", geography = "TYPE499", measures=c(20100)) +saveRDS(z0, file = "z0.rds") + +# Get table of Census 2011 religion data from nomis +z <- nomis_get_data(id = "NM_529_1", time = "latest", geography = "TYPE499", measures=c(20301)) +saveRDS(z, file = "z.rds") +z <- readRDS(file = (here("example_data", "z.rds"))) + +# grab data from nomis for 2011 census religion / ethnicity table +z1 <- nomis_get_data(id = "NM_659_1", time = "latest", geography = "TYPE499", measures=c(20100)) +saveRDS(z1, file = "z1.rds") + +# grab data from nomis for 2021 census religion / ethnicity table +z2 <- nomis_get_data(id = "NM_2131_1", time = "latest", geography = "TYPE499", measures=c(20100)) +saveRDS(z2, file = "z2.rds")