hrbrmstr / statebins

Alternative to choropleths of US States ala http://bit.ly/statebins
Other
124 stars 28 forks source link

Print state abbreviation even if value is NA #14

Open mkiang opened 6 years ago

mkiang commented 6 years ago

Right now the state abbreviations will not print if a value is NA:

library(statebins)
library(dplyr)
data(USArrests)

USArrests$state <- rownames(USArrests)
USArrests$Assault[1] <- NA

statebins(USArrests, value_col="Assault", name = "Assault", round=TRUE) +
    theme_statebins(legend_position="right")

Which returns this error:

1: In .sb_invert(gb$data[[1]]$fill, dark_label, light_label) :
  NAs introduced by coercion

It would be nice to still have the abbreviation printed -- possibly with a user-specified color.