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

Package Description

fars package reads and plots Fatality Analysis Reporting System (FARS) data from the National Highway Traffic Safety Administration.

FARS is a nationwide census, providing the American public yearly data, regarding fatal injuries suffered in motor vehicle traffic crashes.

Load Packages

library(fars)
library(maps)
library(dplyr)
library(fars)

Included data

The data files included within the package are:

list.files(system.file("extdata", package = "fars"))

Package Functions

Function make_filename

This function creates a filename from on a chosen year.

make_filename(2015)

Function fars_read_years

This function create a list for each specified year containing a tibble with month and year columns referred to a fars_read file. It also check if there is data for the selected year.

years <- c(2013,2014,2015)
fars_read_years(years)

Function fars_summarize_years

The function return a tibble summarizing the number of observations for each month in the selected years.

years <- c(2013,2014)
fars_summarize_years(years)

Function fars_map_state

The function returns a map with incidents' coordinates or NULL in case of no accidents.

fars_map_state(1,2013)


langbart/fars documentation built on Dec. 21, 2021, 8:49 a.m.