dictionary - US label value map in R -
i using data result ([https://drive.google.com/file/d/0b0zk9xcdoi1sq1jazfzyx1fqauu/view?usp=sharing])
what trying color states of map based on label value in state, using maps package.
i trying use following code, doesn't work.
library(choroplethr) gtd <- read.csv("/users/urad_jeff/documents/image analysis/result png/state.csv") statelabel<- ddply(gtd, .(y), "nrow") colnames(statelabel) <- c("label", "value") statelabel$label <- tolower(statelabel$label) statelabel$label <- gsub(" (u.s. state)", "", statelabel$label, fixed=true) choroplethr(statlabel, lod="state")
the wanted result image looks :
here closest (you have missing states):
library(choroplethr) library(choroplethrmaps) library(plyr) gtd <- read.csv("state.csv") 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) # warning in super$initialize(map.df, user.df) : # data.frame contains following regions not mappable: # washington (state), unknown # warning in self$bind() : # following regions missing , being set na: north dakota, # rhode island, south dakota, district of columbia
Comments
Post a Comment