Census API Key

Before you run this script, you will need to add your Census API key below.

tidycensus::census_api_key("<PASTE YOUR KEY HERE>", install = TRUE)

Setting install = to TRUE will store your API key in your .Renviron to so that it is available in future sessions.

Importing Data

library(tidyverse)
library(sf)

Read in case data coordinates file and convert to sf object.

raw_data <- read_csv('./simulated_case_locations.csv')

d_events <- st_as_sf(raw_data, coords = c('X', 'Y')) %>% 
    st_set_crs(4326)

Quick check on event data.

mapview::mapview(d_events)@map