knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

This package allows you to determine the number of accidents per month in the United States National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS) data and map these accidents within each state.

Accessing the package

The latest development version of the package can be found on GitHub and can be directly loaded using the following code:

library(devtools)
install_github("mahonmb/FARSfun")
library(FARSfun)

Data Access

The data used in these examples can be found at the United States National Highway Traffic Safety Administration's Fatality Analysis Reporting System

Simple example

As a very simple example, here is how you can determine the number of accidents per month in a given year:

fars_summarize_years(2013)

The column of MONTH is an integer giving the number of each month in order from 1 to 12. The column of '2013' is an integer that represents that number of fatal accidents within each month of 2013. Note that '2013' will change depending on the year reported.

Additionally, you are able to map the location of fatal accidents within each state (using state.num to indicate the state - numbers correspond to alphabetical ordering of the states) for a given year (using year).

#Here I map fatal accidents in Alabama in 2013
fars_map_state(1,2013)


mahonmb/FARSfun documentation built on May 29, 2019, 11:40 a.m.