library(tidyverse)
library(nomisr)
# ---- Load data and prep ----
# TS011 - Households by deprivation dimensions
# Parameter values in nomis_get_data() based on this URL: https://www.nomisweb.co.uk/api/v01/dataset/NM_2031_1.data.csv?date=latest&geography=637536588...637536596,637540863,637541007,637536597...637536614,637540768,637536615...637536631,637540769,637540864,637536632...637536653,637541008...637541011,637536654...637536666,637541006,637538323...637538386,637540972,637539688...637539722,637541053...637541055,637535843...637535865,637540848,637541043...637541052,637535866...637535954,637535819...637535842,637540798,637540799,637541042,637536667...637536744,637537855...637537883,637537896...637537916,637540980,637540981,637537838...637537854,637537884...637537895,637537917...637537934,637538008...637538071,637539184...637539194,637540836,637539195...637539243,637540826,637539244...637539254,637540953,637539255...637539286,637540839,637539287...637539332,637535141...637535249,637540856,637540865...637540870,637540933...637540936,637535250...637535281,637540950,637540951,637535282...637535333,637540908...637540914,637535334...637535551,637540883...637540885,637535552...637535573,637540886,637540887,637535574...637535653,637536745...637536774,637540770,637541027,637541028,637536775...637536814,637540771,637540846,637540847,637536815...637536835,637541029,637536836...637536882,637539723...637539728,637540989,637539729...637539738,637540990,637540991,637539739...637539770,637540992,637540993,637539771...637539794,637535654...637535753,637540952,637535754...637535818,637540760,637540800,637540801,637540824,637540825,637536295...637536353,637540896...637540899,637536354...637536542,637540809,637540817,637540830,637540831,637536543...637536587,637536883...637536944,637540772,637540774,637540776,637540807,637540808,637540915,637540916,637536945...637536982,637540791,637540858,637540859,637541030,637539601...637539606,637539617...637539636,637539678...637539687,637540818,637540819,637541018,637541019,637539607...637539616,637539637...637539677,637541020,637541021,637538072...637538086,637540784,637538087...637538117,637540979,637538118...637538131,637540785,637538132...637538141,637540827,637538142...637538153,637540761,637538154...637538163,637540872,637540873,637539333...637539343,637540777,637539344...637539374,637540773,637539375...637539411,637540775,637540917,637540918,637539412...637539417,637540820,637540821,637539418...637539457,637540822,637540823,637539458...637539495,637539795...637539823,637540857,637539824...637539836,637540860,637539837...637539850,637540792,637539851...637539891,637536983...637537027,637540998,637540999,637537028...637537059,637540925,637539976...637540014,637540086...637540153,637540932,637540154...637540192,637540430...637540452,637540763,637540453...637540463,637540996,637540997,637540464...637540493,637540654...637540738,637535955...637536075,637540764,637540766,637540850...637540855,637540986...637540988,637536076...637536116,637540762,637536117...637536195,637540767,637540894,637540895,637536196...637536223,637540765,637536224...637536294,637540849,637537300...637537319,637540832,637540833,637537320...637537339,637540888,637540889,637537340...637537372,637540816,637540878,637540954,637540955,637537668...637537686,637540960,637540961,637537651...637537667,637537687...637537702,637537768...637537779,637541034,637541035,637537780...637537788,637540782,637537789...637537837,637540828,637540829,637541033,637538454...637538534,637540928,637540929,637538535...637538552,637540875,637541004,637541005,637538553...637538597,637540930,637540931,637538598...637538624,637538861...637538895,637538913...637538939,637541036,637541037,637538970...637538993,637539496...637539575,637540982,637540983,637539576...637539586,637540861,637540862,637541000,637541001,637539587...637539600,637541002,637541003,637540193...637540203,637540210...637540237,637538940...637538958,637541038,637538994...637539008,637541040,637538896...637538912,637541041,637538959...637538969,637541039,637540252...637540281,637540204...637540209,637540238...637540251,637540783,637534209...637534230,637540756,637534231...637534270,637540904,637540905,637534271...637534297,637540743,637534298...637534330,637540906,637540907,637534331...637534366,637540740,637540745,637540747,637534367...637534392,637541063,637534393...637534434,637540746,637540937,637540938,637534435...637534470,637540749,637540919...637540922,637534471...637534505,637540751,637534506...637534531,637540744,637540879...637540882,637540941...637540944,637534532...637534555,637540871,637540874,637541056...637541059,637534556...637534615,637540752,637534616...637534643,637540753,637540837,637534644...637534704,637540754,637534705...637534730,637540750,637540923,637540924,637534731...637534828,637540758,637534829...637534860,637540741,637540742,637540755,637540958,637540959,637534861...637534920,637540945...637540949,637534921...637534946,637540757,637540876,637540877,637540967...637540970,637534947...637535000,637540759,637540892,637540893,637535001...637535023,637540793,637535024...637535052,637540810,637540811,637541060...637541062,637535053...637535116,637541031,637541032,637535117...637535140,637537373...637537464,637540890,637540891,637537465...637537477,637541016,637541017,637537478...637537545,637540962...637540966,637537546...637537601,637540778,637540926,637540927,637537602...637537632,637541022,637541023,637537633...637537650,637537703...637537767,637540780,637540781,637538387...637538397,637540814,637540815,637538398...637538453,637538699...637538733,637540786,637540795,637538734...637538797,637540779,637540787,637540788,637538798...637538846,637541024...637541026,637538847...637538860,637539009...637539021,637540994,637540995,637539022...637539038,637540812,637540813,637539039...637539111,637540789,637539112...637539123,637540834,637540835,637539124...637539169,637540790,637539170...637539183,637539892...637539927,637540971,637541064,637539928...637539960,637540841,637539961...637539975,637540282...637540307,637540794,637540308...637540401,637540748,637540402...637540417,637540796,637540418...637540429,637540494...637540593,637537060...637537135,637540842...637540845,637540900...637540903,637537136...637537159,637540802,637540803,637537160...637537189,637541012...637541015,637537190...637537220,637540939,637540940,637537221...637537236,637540797,637537276...637537299,637540804...637540806,637537935...637538007,637540739,637540594...637540653,637540973...637540976,637537237...637537275,637538270...637538276,637540838,637540840,637538277...637538322,637540956,637540957,637538164...637538182,637540977,637540978,637538183...637538269,637538625...637538698,637540984,637540985,637540015...637540085,637541065...637541119,637541464,637541120...637541154,637541468...637541470,637541172...637541179,637541465,637541180...637541219,637541463,637541220...637541248,637541472,637541249...637541264,637541462,637541471,637541265...637541298,637541413...637541458,637541466,637541467,637541299...637541329,637541336...637541412,637541155...637541171,637541459,637541461,637541330...637541335,637541460&c2021_dep_6=0...5&measures=20100,20301
raw <-
nomis_get_data(
id = "NM_2031_1",
date = "latest",
geography = "TYPE151", # LSOA (20s1)
c2021_dep_6 = "0...5",
measures = c(20100, 20301) # Values
)
census21_deprivation_england_wales_lsoa21 <-
raw |>
filter(C2021_DEP_6 > 0) |>
select(
lsoa21_code = GEOGRAPHY_CODE,
households_number_deprivation_dimensions = C2021_DEP_6,
type = MEASURES_NAME,
value = OBS_VALUE
) |>
mutate(households_number_deprivation_dimensions = households_number_deprivation_dimensions - 1) |>
pivot_wider(names_from = type, values_from = value) |>
rename(
count = Value,
percent = Percent
)
usethis::use_data(census21_deprivation_england_wales_lsoa21, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.