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

FARS Package Description

This package contains R functions which provide information from the Fatalities Analysis Reporting System. The data is from the \strong{US National Highway Traffic Safety Administration's} \emph{Fatality Analysis Reporting System} (FARS), which is a nationwide census, providing the American public yearly data, regarding fatal injuries suffered in motor vehicle traffic crashes. For more information, see: (https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars)

Install and load package

You can install FARS from GitHub by

library(devtools)
install_github("KvEijden/FARS")

Included data

The package includes the data from 2013 to 2015 from the Fatalities Analysis Reporting System. The data can be read in the following way:

fars_data_dir   <- system.file("extdata", package = "FARS", mustWork = FALSE)
fars_data_files <- list.files(fars_data_dir, full.names = TRUE)
fars_data_files

library(readr)
fars_data <- readr::read_csv(fars_data_files[1])
head(fars_data)

Exported functions

To summarize the the number of fatal injuries use the function fars_summarize_years.

head(fars_summarize_years(2013), n = 4)

To display a map of fatal injuries by state and year use fars_map_state.

fars_map_state(state.num = "04", year = 2015)


KvEijden/FARS documentation built on June 11, 2019, 1:30 p.m.