New release: Choroplethr v3.2.0

Today I am happy to announce that a new version of choroplethr, v3.2.0, is now available. You can get it by typing the following from an R console:


Note that it sometimes takes a few days for new packages to get copied to each CRAN mirror. If install.packages(“choroplethr”) only gets you version 3.1.0, please try again tomorrow.

This version contains three changes.

Change #1: Better Default Projection

The most significant change is the addition of a better default map projection. I have discussed the issue of map projections in R at length here and here, among other places. Today I simply want to thank Hadley Wickham for pointing me to  coord_quickmap(), which gives you a nice projection that also works with insets. Here is a comparison between the old and new maps:



new = county_choropleth(df_pop_county, 
                        title = "New Default")

old            = CountyChoropleth$new(df_pop_county)
old$title      = "Old Default"
old$projection = element_blank()
old            = old$render()

grid.arrange(new, old, ncol=2)


Change #2: Better Border Control

On maps with many small regions, the borders can obscure information. Look at the map below, which shows all the zip codes in New York state.


In previous version of choroplethr it was hard to make the right-hand map. Choroplethr 3.2.0 simplifies this process quite a bit. It adds a ggplot_polygon member variable to the base Choropleth object. If you set it to geom_polygon(aes(fill=value), color=NA), as shown below, then the borders disappear:


default = zip_choropleth(df_pop_zip, 
                         state_zoom = "new york",
                         title = "With Border") + 

c = ZipChoropleth$new(df_pop_zip)
c$title = "Without Border"
c$ggplot_polygon = geom_polygon(aes(fill = value), 
                                color = NA)
c$set_zoom_zip(state_zoom  = "new york", 
               county_zoom = NULL, 
               msa_zoom    = NULL, 
               zip_zoom    = NULL)

no_border = c$render() + 
              theme(legend.position = "none")

grid.arrange(default, no_border, ncol = 2)

Change #3: Continental US States

In my own work I frequently zoom in on the contiguous United States. I got tired of continually computing this vector of state names, so I added it as the variable continental_us_states. Here is an example:



                  state_zoom = continental_us_states)            

In Other News

On Tuesday I wrote a guest blog post titled Following up on news stories with choroplethr and R on the Revolution Analytics blog. In it I describe how I used R and choroplethr to research how fracking has changed the demographics of North Dakota. I first learned about this issue in an interview that Russ Roberts did with Gregory Zuckerman on the EconTalk podcast. The post is of technical interest because I demonstrate how to calculate the percentage change in census demographics.

michael petrillo says January 12, 2016

Ari – thank you for the excellent package

    Ari Lamstein says January 12, 2016

    Thank you for the kind words Michael!

Achim Rumberger says May 9, 2016

Ari – very cool stuff.

    Ari Lamstein says May 9, 2016

    Thank you!

Comments are closed