Skip to content

Instantly share code, notes, and snippets.

@rcatlord
rcatlord / script.R
Last active April 3, 2024 14:13
Median age by local authority
# Median age by local authority
# Source: 2021 Census
# URL: https://www.nomisweb.co.uk/datasets/c2021ts007
library(tidyverse) ; library(nomisr) ; library(sf) ; library(tmap)
# return Topic Summary tables
metadata <- nomis_search(name = "TS*")
# filter Topic Summary tables containing 'Age'
@rcatlord
rcatlord / data.csv
Last active January 10, 2024 13:54
Coastal proximity
We can't make this file beautiful and searchable because it's too large.
LSOA21CD,distance,category
E01019077,0.10361514589979325,0-1 km
E01019038,0.12681787390950452,0-1 km
W01000119,0.13977966005027612,0-1 km
E01034162,0.14892747500810688,0-1 km
E01018839,0.15550538144131065,0-1 km
E01021988,0.16222577338540511,0-1 km
W01002001,0.17191744119083788,0-1 km
E01020985,0.17505445007255382,0-1 km
E01019001,0.18836402337173075,0-1 km
@rcatlord
rcatlord / README.md
Last active December 4, 2023 16:41
Pattern plot

plot

@rcatlord
rcatlord / script.R
Created March 3, 2023 13:27
Census data for bespoke geographies
# Returning Census data for custom geographies #
# Load packages ---------------------
library(tidyverse)
library(sf)
library(mapedit)
library(mapview)
library(RColorBrewer)
# Retrieve data ---------------------
@rcatlord
rcatlord / map.svg
Created December 14, 2022 13:54
Choropleth map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rcatlord
rcatlord / README.md
Last active December 5, 2022 16:46
Measuring spatial autocorrelation

LISA cluster map

@rcatlord
rcatlord / README.md
Last active October 31, 2022 10:51
Data classification methods

jenks

@rcatlord
rcatlord / README.md
Last active October 17, 2022 15:04
theme_ONS

figure1

@rcatlord
rcatlord / babynames1996to2020.md
Last active September 2, 2022 12:08
Baby names in England & Wales, 1996-2020
library(tidyverse)

df <- read_csv("https://raw.githubusercontent.com/rcatlord/ddj/main/data/babynames1996to2020.csv")

selected_name <- "Alex"

df %>% 
  filter(name == selected_name) %>% 
  ggplot(aes(x = year, y = n)) +
@rcatlord
rcatlord / README.md
Last active July 19, 2022 12:32
Child poverty and air pollution

plot