fars_map_state: Plot FARS accident data on maps of US states

Description Usage Arguments Details Value Examples

Description

This function makes use of the geographic data contained in FARS accident data sets to plot accidents on maps of US states.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

The numeric code (as numeric or integer) of the US state to be analysed. Numeric codes can be found e.g. on Wikipedia.

year

The year (as numeric or integer) from which the data is to be plotted.

Details

The function internally uses the make_filename and fars_read functions to read in the FARS data for the given year and than filters for the given state. The geographic data is extracted and plotted using the maps package.

Value

The function returns a plot with a graphical representation of the selected US state with the accidents of the indicated year plotted as dots on the map according to their geographic location. If the data set contains no accidents for the indicated year and state, the message "no accidents to plot" is printed to the console and if an invalid state number is given as input, a warning will be displayed.

Examples

1
## Not run: fars_map_state(31,2015) #Plot all accidents that happened 2015 in Nebraska.

tdo15/fars documentation built on May 3, 2019, 10:45 p.m.