How to get started on creating choropleth map

84 views Asked by At

The task at hand is mapping the empprevyearpct value to a county map. The sample data is below.

library(tidyverse)
library(tigris)

countyname <- c("Carson City","Churchill County","Clark County","Douglas County","Elko County","Esmeralda County","Eureka County","Humboldt County","Lander County","Lincoln County","Lyon County","Mineral County","Nye County","Pershing County","Storey County","Washoe County","White Pine County")

prevyearpct <- c(.545,.541,.539,.401,.301,.201,.101,.001,.664,.604,.704,.123,.129,.130,.085,.015,.099)

data2 <- data.frame(countyname, prevyearpct)

Here is the code that I use from Tigris to get the shape file.

NV_counties <- counties(32)

I do not need the work done for me. If I was to map the prevyearpct values on to the counties, where would I start? Do I need to append the data so that the NV_Counties and data2 are one consolidated item? I have read quite a few articles/tutorials but nothing that uses tigris.

1

There are 1 answers

0
tonybot On BEST ANSWER

You can use geo_join() to join the two datasets together. After that, you can use geom_sf() to map it out (this guide may help).