The purpose of this assignment is to use the methods of section 2.5.8 as a template to recreate the choropleth of median housing values done in the March 1 notes.

Setup

library(tidycensus)
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.0.6     v dplyr   1.0.4
## v tidyr   1.1.2     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(tmap)
library(tmaptools)
library(janitor)
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1

Problem 1

Copy the code from the March 22 notes to reproduce the choropleth.

# Place the code here.
EW = st_read("C:/Users/Braden/Documents/CSC495/statistical-gis-boundaries-london/Local_Authority_Districts_(December_2015)_Boundaries.shp")
## Reading layer `Local_Authority_Districts_(December_2015)_Boundaries' from data source `C:\Users\Braden\Documents\CSC495\statistical-gis-boundaries-london\Local_Authority_Districts_(December_2015)_Boundaries.shp' using driver `ESRI Shapefile'
## Simple feature collection with 380 features and 6 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 5513 ymin: 5333.602 xmax: 655989 ymax: 1220302
## projected CRS:  OSGB 1936 / British National Grid
load(file = "~/CSC495/gv.RData")

#EW is the data we read in straight from the web
BoroughDataMap <- EW %>%
  clean_names()%>%
  # the . here just means use the data already loaded
  filter(str_detect(lad15cd, "^E09"))%>%
  merge(.,
        LondonData, 
        by.x="lad15cd", 
        by.y="new_code",
        no.dups = TRUE)%>%
  distinct(.,lad15cd, 
           .keep_all = TRUE)

Problem 2

Use qtm() to produce a simple choropleth.

# Place your code here.

qtm(BoroughDataMap, 
    fill = "rate_of_job_seekers_allowance_jsa_claimants_2015")

Problem 3

Use the code in section 2.5.8 as a template to create a better choropleth.

# Place your code here.

qtm(BoroughDataMap, 
    fill = "population_2015") + 
tm_bubbles("median_house_price_2014", "red", border.col = "black", title.size="median house price 2014") +
  tm_scale_bar()  +
  tm_compass(position = c("left", "bottom"),type = "arrow") +
  tm_layout(title = "Population and House Price", legend.outside = TRUE) + 
  tmap_style("natural")
## tmap style set to "natural"
## other available styles are: "white", "gray", "cobalt", "col_blind", "albatross", "beaver", "bw", "classic", "watercolor"
## Legend labels were too wide. Therefore, legend.text.size has been set to 0.54. Increase legend.width (argument of tm_layout) to make the legend wider and therefore the labels larger.