fars_map_state: Plot accidents on a state map.

Description Usage Arguments Details Value Examples

Description

This function takes a state number and year as its argumants, and returns a map of all all accidents in that state and year. The function requres FARS raw datsets saved in getwd().

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

an integer, or an object that can be coerced into integer, representing a state number

year

an integer, or an object that can be coerced into integer, representing a calendar year

Details

An invalid state number throws an error. If no accides found in that state, the function returns NULL silently. The function uses imported maps::map() to plot the data.

Value

a plot of a state accidents on a map

Examples

1
2
3
4
# unzip files into your \code{getwd()}
my_file <- system.file("extdata", "fars_data.zip", package = "fars")
unzip(my_file, junkpaths = TRUE)
fars_map_state(16, 2015)

vadimus202/fars documentation built on May 3, 2019, 2:41 p.m.