For today, I’ve given you a number of shapefiles associated with worldmaps, state maps of the US, and county maps of Massachusetts and the coronavirus. You can download the data here. I’d like you to take a gander and think about what you can do with them.
To start with, let’s take a look at the world.
library(sf)
library(ggplot2)
worldmap <- st_read("./data/coronavirus_shapefiles/worldmap.shp")
## Reading layer `worldmap' from data source `/Users/jarrett.byrnes/Dropbox (Byrnes Lab)/Classes/Biol 355 Ugrad_Data_Science/Labs/data/coronavirus_shapefiles/worldmap.shp' using driver `ESRI Shapefile'
## Simple feature collection with 177 features and 63 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -180 ymin: -90 xmax: 180 ymax: 83.64513
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
ggplot(worldmap) +
geom_sf() +
coord_sf()
That’s a nice example workflow for loading and plotting one single shapefile. The shapefiles I have given you have multiple rows for dates, geospatial areas, and different case types (confirmed, death, recovered). You should be somewhat familiar with this already.
With that in mind, I’d like you to -