Motor vehicle collisions in New York City - R / Shiny Data Visualization

Introduction

Shiny by RStudio is a web application framework targeted for R programmers. It allows our analysis to be extended as an interactive web application  that can be quickly developed and deployed using RStudio. The post presents how vast amount of data is easily filtered and used as input to the visualizations that were developed.

Data Source

The data that has been published under the New York open data project contains details of all motor vehicle collisions and related data including location and timing information as well as details of the vehicle involved in the collision and the root cause. The data can be accessed at https://data.cityofnewyork.us/Public-Safety/NYPD-Motor-Vehicle-Collisions/h9gi-nx95

The source data consists of around 948,000 records and by designing a shiny based interface to filter data with the goal of finding trends.

The Shiny Interface

The user interface has been designed such that the left side contains a bar that contains radio buttons and filter controls that lets the user filter the data according to our analysis needs.

Filter Control

ui-control

The interface lets us filter the data according to our needs.

Tabbed Detail Interface - Data Visualization

The tabbed detail interface lets the user view various types of visualizations that were created based on the filtered data. For e.g., it lets the user see the accidents based on the hour of the day it happened. Selecting another tab lets you see the same data on top if a map.

hourofincident

Spread of the accidents based on the day of the week.

weekofthedayplot

 

 

Accident density based on the month of the year.

monthlydistribution

Accidents mapped on top of a map of New York City.

locationsofincidents

Summarized information based on the density of accidents across NYC

accidentdensity

Detailed information related to the data records that are filtered based on the selected controls.

datatableview

Visualization depicting the type of the vehicles involved in the accidents.

singlevehicleaccidentvehicletype

Based on an alternate filter, we see that the shiny app allows the user to see the same graph based on the new filter selection.

multivehiclevehicletypes

 

Conclusion

Shiny application is a quick way to allow business users to have greater control over the data. The visualization that we develop can be deployed in such a way that it allows users greater control over the capability. The reports can be regenerated based on their needs.

 

Smitha Mathew
Smitha Mathew
Technology Enthusiast, with attention to detail, having global exposure. She is a self-motivated problem solver with experience analyzing data and deriving meaningful statistical information. Her goal is to be able to make a positive difference in peoples lives by applying concepts that she learned in her education and experiences gained during her past professional career. She holds a Bachelors & Masters in Computer Science and also holds an MBA Degree with a concentration in Finance from University of Delaware. She has several years of experience as a Business analyst. Her prime interest in Data Analytics made her invest a lot of effort learning the R programming language that allows to gain meaningful information from lots of data using its powerful data visualization techniques. And applying machine learning methods to build predictive models. She hopes to make use of the learning here towards a career focused on data science.

2 Comments

  1. […] article was first published on R – NYC Data Science Academy Blog, and kindly contributed to […]

  2. Bernardo Lares says:

    Please do share the Shiny link, thanks! 😉

Leave a Reply

Your email address will not be published. Required fields are marked *