fars_map_state: Plots the accidents on the US map

Description Usage Arguments Details Value Examples

View source: R/fars_functions.R

Description

The function takes the state number and year as an input, and plots the accidents on the US map.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

Numeric or integer value representing the state of the US as per the FARS data.

year

Numeric or integer value representing the year of the accidents.

Details

The state number must be an integer or numerical and must exist in the FARS data, otherwise the functions terminates with an error. Also returns an error if the data file for the year input does not exist. Finally, returns an error if the state or year does not exist in the data set.

The function requires the use of the dplyr, maps and graphics libraries.

Value

Returns a plot of the US containing the accidents based on the state and year.

Examples

1
fars_map_state(34, 2014)

MarcEres/FarsFinal2 documentation built on Dec. 17, 2021, 2:20 a.m.