Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Clear Objects
- rm(list = ls())
- #Set Working Directory
- setwd("C:/Users/roger/OneDrive - The University of Nottingham/Political Data/v11")
- #Install Packages (*un-comment if needed*)
- #install.packages("tidyverse")
- #install.packages("patchwork")
- #Load Packages
- library(tidyverse)
- library(patchwork)
- #Load in our shapefile
- world_map <- map_data("world")
- #Read Data Set
- full_covid_data <- read.csv("JHU-UN-IPU_Covid.csv")
- full_covid_data
- #Filter Data Set
- covid <- filter(full_covid_data, monthlyDateN == c(2021.09,2020.06))
- #Merge variables of interest
- covidmap <- left_join(world_map, covid, by = c(region = "country"))
- covidmap2 <- filter(covidmap, total_cases != 0 )
- map <- ggplot() + geom_polygon(data = covidmap2, color = "black", size = 0.25,
- aes(x = long, y = lat, group = group, fill = (death/total_cases)))
- map + geom_path() + scale_fill_gradient(low = "blue", high = "red") +
- theme(axis.text.x = element_blank(), axis.text.y = element_blank(), axis.ticks = element_blank()) +
- labs(title = "Lethality of COVID", fill = "Deaths / cases", x = "", y = "") +
- theme(panel.background = element_blank()) + facet_wrap(~monthlyDateN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement