Visualization of Gun Violence Incidents in US

US is famous for its second amendment: the right to bear arms. As a side effect, the amount of gun violence incidents are also very high. For my shiny project, I chose to work with this dataset and try to glimpse into some statistics behind these incidents. My shiny app can be found here, and the source code is available on my github here.

The Dataset:

The data was downloaded from the Gun Violence Archive's website. It contains roughly 240k incidents ranging from 1/1/2013 to 3/31/2018. The record includes rich information about each incident, such as date, place, information about participants, information about guns involved, incident characteristics and so on. I first cleaned the data with the following criterion in mind: I would like the information to be as complete and accurate as possible. So I filtered out those observations with missing or inconsistent information. I ended up with a dataset encompassing roughly 180k incidents.

The Shiny app:

The dashboard contains three tabs on the sidebar: an interactive map to show the distribution of incidents on the map, a collection of interactive charts to show aggregated statistics and a table to give further information about each incident. There are also two filters on the sidebar for the users to use to select the information they would like to display: either by number of victims or by characteristics of incidents.

The interactive map displays cluster points of the incidents happened between the time frame of users' choice. And the popup contains brief information of the incidents alongside with a URL directed to the page from the gun violence archive's website where further information can be found. For example, the map below shows the distribution of all incidents with drug involvement in the dataset and highlights a particular incident that happened in North Platte. ( The map is defaulted to focus on the mainland. though users can drag around to see more on Alaska and Hawaii.)

The interactive charts contain numbers by states, numbers by years, quarters and months.

For example, the bar plot below shows the number of incidents which result in at least 4 victims, ordered by number decreasingly.

Here are two charts showing number of incidents which involve children: the first one shows a trend of increasing numbers during 2014 to 2017 and the second one shows distribution among different months.

Finally, the datatable shows more information about the incidents. Note how many different characteristics are assigned to some incidents.

For example, the table below shows first 10 incidents which contain political violence in the description of characteristics.

Further Work:

Instead of raw number of incidents, I would augment the dataset with populations of different states and compare by the relative number. Also, I would analyze large cities and compare with the states to see if most incidents occur in large cities or not.

There are roughly 110 different incident characteristics in this dataset. I would analyze the distribution of these characteristics and see if there are some patterns.

I would analyze the distribution of subject-suspects' ages and genders and the distribution of guns used/involved. And to answer the following question: do gender and ages correlate to the number of victims?

About Author

Fangye Shi

Fangye graduated from Indiana University at Bloomington with PhD in mathematics. He loves solving problems and learning new things in the rapid growing field like data science!