data(choroplethr)
library(Hmisc) # for cut2
# States with greater than 1M residents
df.map = bind_df_to_map(df_pop_state, "state")
df.map$value = cut2(df.map$value, cuts=c(0,1000000,Inf))
render_choropleth(df.map, "state", "States with a population over 1M", "Population")
# Counties with greater than or greater than 1M residents
df.map = bind_df_to_map(df_pop_county, "county")
df.map$value = cut2(df.map$value, cuts=c(0,1000000,Inf))
render_choropleth(df.map, "county", "Counties with a population over 1M", "Population")
# Zip Code Tabulated Areas with less than 1000 people
df_pop_zip = df_pop_zip[df_pop_zip$value < 1000, ]
df.map = bind_df_to_map(df_pop_zip, "zip")
render_choropleth(df.map, "zip", "ZCTAs with less than 1000 people in California", states="CA")Run the code above in your browser using DataLab