Visualizing Philadelphia's Crime With Animated GIFs

I recently began experimenting with making animated GIFs in R. This process is surprisingly easy with the ggplot2 extension gganimateI have found that animated plots or maps can be very effective tools to demonstrate time-series patterns in data and can be a great alternatives to small multiples or 3D plots.

I chose to experiment with gifs using crime data for the City of Philadelphia from 2007-2016. I was interested in the time-space trends in crime, specifically how crime-frequency varies by time of day in different parts of the city. After spatially joining each crime incident to a census tract, I used dplyr to summarize by tract and hour of the day. 

After some wrangling, I had a dataset of the total number of incidents in all categories of crime for each tract in each hour of the day. I then created two animated plots and arranged them into the following data visualization:

Interestingly, I didn't see the nighttime spike in crimes that I would have expected. I suspected this to be the case because of the broad range of crime types I had included. I re-created the same visualization but this time only including alcohol-related crimes:

And again with just violent crimes:


There is a predictable spike alcohol-related crimes at night (when most drinking occurs) but interestingly we don't see the same pattern for violent crimes. 

Mapping Wealth, Inequality, and Economic Mobility in Higher Education (webmap)


The New York Times recently published an (I think astonishing) piece about income inequality at elite colleges. They reported that 38 schools have more students from the top 1% of the nation's income distribution than from the bottom 60%.

I tracked down the original dataset, which came from The Equality of Opportunity Project, an organization that seems to be doing some really interesting research. Naturally, I was interested in how these data look spatially. I geocoded every college in the U.S. and mapped them based on the economic characteristics of their students. Here is an example of all schools mapped by the median household income of their students.

Orange points represent colleges with the highest family median incomes and purples points show the lowest

I created a webmap to explore several different variables within the dataset. I hope you'll check it out. You can also see the source code for this project here.

Spatial cross-validation with ESRI's R-Bridge

A couple of years ago, ESRI announced that it was developing a tool that would allow it's users to connect between ArcGIS and R. With the R-ArcGIS Bridge, users can read and write shapefiles and tables to and from ArcGIS from an R console. They can also create ArcGIS tools from R scripts. This package makes it possible to access R's vast array of statistical tools from within ArcGIS.

Read More