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

The document introduces the package FarsFunctions. The packages loads and analyzes data from US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS).

Functions

The package provides the following functions: fars_summarize_years() calculates the number of accidents per month for the particular years fars_map_state() maps the accidents for a given US state and year

These functions builds on basic functions to read files, make file names and read years: make_filename() creates the name of the files that holds the data of a year. fars_read() reads a fars file, file name can me provided by make_filename. fars_read_years() reads fars file for multiple years.

Example: summarize monthly accidents

fars_summarize_years() calculates the number of accidents per month for the particular year(s).

For example, the following command gives the number of accidents per months for year 2013.

fars_summarize_years(years=2013)

Example: Map accidents by State

fars_map_state() maps the accidents for a given US state and in a given year.

For example, you can map the road fatality for State X in year 2013 with:

fars_map_state(state.num = 10, year = 2013)


Kakakia/FarsFunctions documentation built on May 16, 2019, 4:03 a.m.