Faster Admin 1 Maps in Choroplethr

January 4, 2016

(This article was first published on R –, and kindly contributed to R-bloggers)

A new version of ChoroplethrAdmin1 is now on CRAN, and it dramatically speeds up making Administrative Level 1 maps in choroplethr. “Administrative Level 1” is just a generic term for “1st subnational division”. In the US this is called a State, in Canada it’s called a Province, and so on. Overall, this package contains Admin 1 maps of 215 countries. Here is how to view the entire Admin 1 map using ggplot2:



ggplot(, aes(long, lat, group=group)) + 


You can get this version of the package by typing the following from an R console:

[1] ‘1.1.0’

Improvements from Version 1.0.0

As the following table shows, this version of the package is both dramatically faster and dramatically smaller than the previous version:

Command v1.0.0 v1.1.0
data(“”) 19.6s 2.7s
admin1_map(“japan”) 20.1s 2.8s
object.size( 545.9 Mb 82.2 Mb

Fun History

This is the first update I’ve made to this package since publishing it in December 2014, and updating it brought back some pleasant memories for me. I wrote the initial version of the package while working in a cafe in Tokyo, the week before I gave a talk on choroplethr at the 2014 Japan.R conference. For old time’s sake I went to google maps and actually found the cafe:

For those of you who don’t read Japanese, the name of the cafe is “Cafe Excelsior Ikebukuro” (Ikebukuro is a neighborhood in Tokyo).

The initial version of the map was enough to satisfy my immediate needs – it allowed me to present choroplethr maps of Japanese census data, and was general enough to work with other countries as well.

But the map was always too slow for me to really enjoy doing exploratory data analysis with it. It was only after hearing from a few users about other issues with the map recently, plus recording screencasts of using the map for my course that really spurred me to revisit the issue. Hopefully this update makes life easier for some other R users out there.

Also, a big thanks to Nathaniel V. Kelso and everyone else who works on Natural Earth Data for creating this shapefile. I simply imported it into R and hooked it up to choroplethr.

The post Faster Admin 1 Maps in Choroplethr appeared first on

To leave a comment for the author, please follow the link and comment on their blog: R – offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)