I'm setting up a new choropleth map for US using choroplethr and stuck in displaying value corresponding to a state over the corresponding states.
I am trying to build a choropleth maps using choroplethr. My table has columns region and value. I succeeded in displaying the state name over the corresponding state. I am also trying to display the corresponding value name over the state name. This is the following line of code i have done to print the state name.
library(choroplethr)
library(choroplethrMaps)
library(dplyr)
gtd <- read.csv("50_us_state_names.csv")
statelabel <- gtd[,2:3]
colnames(statelabel) <- c("region", "value")
statelabel <- gtd[,2:3]
colnames(statelabel) <- c("region", "value")
statelabel$region <- tolower(statelabel$region)
statelabel$region <- gsub(" (u.s. state)", "", statelabel$region,
fixed=TRUE)
state_choropleth(statelabel)
I except the output map display both state name as well as the value over the corresponding state.