<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/motor-vehicle-collisions-in-new-york-city-r-shiny-data-visualization/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.nycdatascience.com/student-works/motor-vehicle-collisions-new-york-city-shiny-visualization/"> R – NYC Data Science Academy Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2><a rel="nofollow" href="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/02/taxi-accident_100333037_m.jpg" target="_blank"><img sizes="(max-width: 584px) 100vw, 584px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/02/taxi-accident_100333037_m.jpg?w=450" alt="" class="wp-image-19834" data-recalc-dims="1"></a></h2>
<h2>Introduction</h2>
<p>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.</p>
<h2>Data Source</h2>
<p>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 <a rel="nofollow" href="https://data.cityofnewyork.us/Public-Safety/NYPD-Motor-Vehicle-Collisions/h9gi-nx95" target="_blank">https://data.cityofnewyork.us/Public-Safety/NYPD-Motor-Vehicle-Collisions/h9gi-nx95</a></p>
<p>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.</p>
<h2>The Shiny Interface</h2>
<p>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.</p>
<h3>Filter Control</h3>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/UI-Control.png" target="_blank"><img sizes="(max-width: 300px) 100vw, 300px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/UI-Control-300x279.png?resize=300%2C279" alt="ui-control" class="wp-image-18178" data-recalc-dims="1"></a></p>
<p>The interface lets us filter the data according to our needs.</p>
<h3>Tabbed Detail Interface – Data Visualization</h3>
<p>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.</p>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/HourOfIncident.png" target="_blank"><img sizes="(max-width: 1261px) 100vw, 1261px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/HourOfIncident.png?w=450" alt="hourofincident" class="wp-image-18179" data-recalc-dims="1"></a></p>
<p>Spread of the accidents based on the day of the week.</p>
<p><a rel="nofollow" href="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/WeekOfTheDayPlot.png" target="_blank"><img sizes="(max-width: 1252px) 100vw, 1252px" src="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/WeekOfTheDayPlot.png?w=450" alt="weekofthedayplot" class="wp-image-18180" data-recalc-dims="1"></a></p>
<p> </p>
<p> </p>
<p>Accident density based on the month of the year.</p>
<p><a rel="nofollow" href="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/MonthlyDistribution-1.png" target="_blank"><img sizes="(max-width: 1256px) 100vw, 1256px" src="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/MonthlyDistribution-1.png?w=450" alt="monthlydistribution" class="wp-image-18183" data-recalc-dims="1"></a></p>
<p>Accidents mapped on top of a map of New York City.</p>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/LocationsOfIncidents.png" target="_blank"><img sizes="(max-width: 1189px) 100vw, 1189px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/LocationsOfIncidents.png?w=450" alt="locationsofincidents" class="wp-image-18184" data-recalc-dims="1"></a></p>
<p>Summarized information based on the density of accidents across NYC</p>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/AccidentDensity.png" target="_blank"><img sizes="(max-width: 1194px) 100vw, 1194px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/AccidentDensity.png?w=450" alt="accidentdensity" class="wp-image-18186" data-recalc-dims="1"></a></p>
<p>Detailed information related to the data records that are filtered based on the selected controls.</p>
<p><a rel="nofollow" href="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/DataTableView.png" target="_blank"><img sizes="(max-width: 1049px) 100vw, 1049px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/DataTableView.png?w=450" alt="datatableview" class="wp-image-18187" data-recalc-dims="1"></a></p>
<p>Visualization depicting the type of the vehicles involved in the accidents.</p>
<p><a rel="nofollow" href="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/SingleVehicleAccidentVEhicleType.png" target="_blank"><img sizes="(max-width: 1258px) 100vw, 1258px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/SingleVehicleAccidentVEhicleType.png?w=450" alt="singlevehicleaccidentvehicletype" class="wp-image-18188" data-recalc-dims="1"></a></p>
<p>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.</p>
<p><a rel="nofollow" href="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/MultiVehicleVehicleTypes.png" target="_blank"><img sizes="(max-width: 1260px) 100vw, 1260px" src="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/01/MultiVehicleVehicleTypes.png?w=450" alt="multivehiclevehicletypes" class="wp-image-18189" data-recalc-dims="1"></a></p>
<p> </p>
<h2>Conclusion</h2>
<p>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.</p>
<p> </p>
<h2></h2>
<p>The post <a rel="nofollow" href="http://blog.nycdatascience.com/student-works/motor-vehicle-collisions-new-york-city-shiny-visualization/" target="_blank">Motor vehicle collisions in New York City – R / Shiny Data Visualization</a> appeared first on <a rel="nofollow" href="http://blog.nycdatascience.com/" target="_blank">NYC Data Science Academy Blog</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.nycdatascience.com/student-works/motor-vehicle-collisions-new-york-city-shiny-visualization/"> R – NYC Data Science Academy Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/wsw4sIYfKG4" height="1"></a></div>