2023-03-24

Getting Started

Importing Libraries
Packages provide a comprehensive set of tools for data visualization and data manipulation. Each of these packages contain various pre-written functions that can assist us in cleaning, reshaping, and visualizing our data.

library(ggplot2)
library(tidyverse)
library(tidyr)
library(dplyr)
library(ggmap)
library(htmltools)

Getting Started

Importing the Data
We will refer to our data set as MotorVehicleCrashes. Note: that this dataset contains nearly two million entries, and most entries contain at least one missing value for a column.

MotorVehicleCrashes <- read.csv("~/Downloads/Motor_Vehicle_Collisions_-_Crashes.csv")

Brief Overview

This dataset contains information about all the motor vehicle collisions that occurred in New York City from 2013-2022 reported by NYPD. It is required of the police department to report these collisions only if there is an injury, fatality, or a minimum of $1,000 in damage.

The following data contains information including: Crash date and time, location (borough, zip code, latitude/longitude, street, cross streets), persons injured or killed (recorded for persons involved, pedestrians, cyclists, and motorists), contributing factors for each vehicle involved, vehicle type.

More information can be found at the link below. https://data.cityofnewyork.us/Public-Safety/Motor-Vehicle-Collisions-Crashes/h9gi-nx95

Objective

By analyzing the dataset and defining the problems it presents, we can help improve public safety by reducing the number of collisions on the road.

It is important to identify trends and patterns in the occurrence of motor vehicle collisions, understand the underlying causes of these collisions, and develop interventions to prevent them. The data can help us identify high-risk areas, specific factors contributing to collisions, and types of vehicles involved.

Additionally, the injury and fatality data can give us a clear understanding of the severity of collisions and their impact on public health and safety. By defining these problems, policymakers, transportation agencies, and community leaders can develop targeted strategies to improve road safety, reduce the number of collisions, and save lives.

The Impact of Collisions

How many collisions have resulted in injuries or deaths over the past ten years? How often are pedestrians, cyclists, and motorists involved in motor vehicle collisions? How often are pedestrians, cyclists, and motorists killed in motor vehicle collisions?

##   totalInjuries      Person
## 1        108036 Pedestrians
## 2         50384    Cyclists
## 3        423739   Motorists
## 4        587331       Total
##   totalDeaths      Person
## 1        1423 Pedestrians
## 2         212    Cyclists
## 3        1135   Motorists
## 4        2805       Total

High-Risk Areas

Let’s first analyze collisions by borough.

## # A tibble: 5 × 4
##   BOROUGH       total_collisions total_injuries total_deaths
##   <chr>                    <int>          <int>        <int>
## 1 BROOKLYN                431428         137634          566
## 2 QUEENS                  365206         105477          483
## 3 MANHATTAN               308260          61639          301
## 4 BRONX                   200794          63134          243
## 5 STATEN ISLAND            57189          15737           88

The table above shows the total number of collisions, the total number of people injured in crashes, and the total number of deaths in motor vehicle crashes for each borough in New York City.

We can conclude from the table that Brooklyn has the most amount of motor vehicle crashes, injuries, and deaths while Staten Island has the least amount of motor vehicle collisions.

Map of Collisions Across NYC

Each coordinate on the map represents a fatal vehicular accident, whether the fatality represents the driver, a pedestrian, or a cyclist.

Collision Patterns

How has the frequency of vehicular collisions changed over the past ten years?

Collision Patterns

Are motor vehicle collisions more likely to occur on a certain day?

Collision Patterns

Are motor vehicle collisions more likely to occur at a certain time of the day?

How Humans Play a Role

The data set presents a hundred reasons how someone could be involved in a motor vehicle accident. What are the leading causes of motor vehicle accidents?

How Humans Play a Role

Which contributing factors are most likely to result in an injury?

## # A tibble: 10 × 2
##    CONTRIBUTING.FACTOR.VEHICLE.1  total_injuries
##    <chr>                                   <int>
##  1 Driver Inattention/Distraction         123590
##  2 Failure to Yield Right-of-Way           56913
##  3 Following Too Closely                   38767
##  4 Traffic Control Disregarded             23141
##  5 Unsafe Speed                            16716
##  6 Fatigued/Drowsy                         12330
##  7 Turning Improperly                      10079
##  8 Alcohol Involvement                     10077
##  9 Passing or Lane Usage Improper           9958
## 10 Driver Inexperience                      8892

How Humans Play a Role

Which contributing factors are most likely to result in a fatality?

## # A tibble: 10 × 2
##    CONTRIBUTING.FACTOR.VEHICLE.1                         total_deaths
##    <chr>                                                        <int>
##  1 Unsafe Speed                                                   351
##  2 Driver Inattention/Distraction                                 327
##  3 Failure to Yield Right-of-Way                                  242
##  4 Traffic Control Disregarded                                    234
##  5 Alcohol Involvement                                             99
##  6 Pedestrian/Bicyclist/Other Pedestrian Error/Confusion           91
##  7 Illnes                                                          53
##  8 Driver Inexperience                                             51
##  9 Passenger Distraction                                           48
## 10 Lost Consciousness                                              43

The Result of Dangerous Driving

What are unsafe driving habits that are most likely to result in a motor vehicle collision?

Vehicle-Related Problems

The Signficance of Analyzing this Data

  • Help identify the most common causes of collisions, which can inform safety policies and interventions aimed at reducing collisions and improving road safety.

  • Help identify areas or intersections with high collision rates, allowing for more targeted allocation of resources such as traffic enforcement, traffic engineering improvements, or educational campaigns.

  • Help insurers and lawyers better understand the risks associated with different types of drivers, vehicles, and road conditions, which can inform insurance policies and legal decisions.

  • Help researchers better understand the factors that contribute to collisions, which can inform the development of new technologies and policies aimed at improving road safety.