fars_map_state: Fatal Incident Plot

Description Usage Arguments Details Value Note Examples

View source: R/fars_functions.R

Description

The function graphically displays the locations of fatal accidents recorded in the US National Highway Traffic Safety Administration's Fatal Analysis Reporting System (FARS). The function accepts a state number and year as parameters.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

State number

year

A vector (or matrix) used to represent the years of the data files to be imported.

Details

The function uses the following previously described functions in this package; make_filename(), fars_read. The function accepts a state.num argument and state.num argument to plot incidents for a given year. Execution will halt if the state number does not exist and return the message invalid STATE number: " x (where x is the state.num argument). If there are no fatalities in a state the function returns 'no incidents to plot'.

Value

This function returns a plot depicting the location of fatal incidents (where a death occured within 30 days of the crash) recorded during a given year for a state.

Note

The dplyr,map and point packages must also be installed in the R environment but do not have to be attached.

Examples

1
2
3
4
5
6
fars_map_state (1,2013)

## Not run: 
fars_read_years(c(2013,2014))

## End(Not run)

gben1750/fatal-car-analysis-reporting-system documentation built on Dec. 20, 2021, 9:49 a.m.