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

This package can be used to read and manage data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.

Importing data

FARS data can be imported using the fars_read_years function:

library(fars)
fars_data <- fars_read(make_filename(2014))

This file contains many information regarind the traffic accidents. The fields contained in the dataframe are

library(magrittr)
library(knitr)
fars_data %>%
  names() %>%
  kable(col.names = 'Columns')

Other usages

The package also contains functions for calculating the summary for a set of years:

fars_summarize_years(2013:2015) %>%
  kable()

And also the capability of plotting data into a map. In this case, the State is to be selected by the State ID.

For the case of California (ID = 6)

fars_map_state(6, 2015)

For the case of New York (ID 36)

fars_map_state(36, 2015)


raggaraluz/master_sw_dev_c3 documentation built on May 21, 2019, 9:22 a.m.