-
Notifications
You must be signed in to change notification settings - Fork 0
/
Repo.Rmd
26 lines (25 loc) · 873 Bytes
/
Repo.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
output:
pdf_document: default
html_document: default
---
```{r}
#THIS IS THE PRACTICAL
library(tidyverse)
library(geojsonio)
library(sf)
library(tmap)
library(tmaptools)
#read some data attributes
LondonData <- read_csv("https://files.datapress.com/london/dataset/ward-profiles-and-atlas/2015-09-24T14:21:24/ward-profiles-excel-version.csv", na = "n/a")
#read some geometries
EW <- geojson_read("http://geoportal.statistics.gov.uk/datasets/8edafbe3276d4b56aec60991cbddda50_2.geojson", what = "sp")
#pull out London
LondonMap <- EW[grep("^E09",EW@data$lad15cd),]
#convert to a simple features object
LondonMapSF <- st_as_sf(LondonMap)
#append the data to the geometries
LondonMapSF <- append_data(LondonMapSF,LondonData, key.shp = "lad15cd", key.data = "New code", ignore.duplicates = TRUE)
#plot a choropleth
qtm(LondonMapSF, fill = "% Not Born in UK - 2011")
```