Let us go back to where we stopped developing our mapping techniques yesterday: Our Covid-19 Map. This is just a super short repetition of what was just presented. No worries, we’re going to have some time to improve your maps in the second exercise.
Recreate a simple Covid-19 map as already created yesterday but use ggplot2 this time.
They don’t have to match perfectly but:
# For importing the data, you can use this code:
library(dplyr)
library(sf)
attributes_districts <- read.csv("./data/attributes_districts.csv",
header = T, fill = T, sep = ",")
german_districts_enhanced <- st_read(dsn = "./data",
layer = "GER_DISTRICTS") %>%
rename(., district_id = id) %>%
st_transform(., crs = 3035) %>%
left_join(., attributes_districts, by = "district_id")
Save your map as a .pdf!
You need the function ggsave to fulfill this task.
Now we want to add another layer to see if enough hospitals are located in the Covid-19 high-risk zones of Germany.
For an extra challenge which we haven’t covered: The hospital shapefile contains information on the number of beds in each hospital. Can you change the size of hospital dots according to the number of beds?
Make sure that the CRS of your hospital layer is defined correctly!
You need to define size = beds as the aesthetics of the new layer.
The variable beds is a character but need to be numeric.