fars_map_state: Plot the Location of FARS incidents in a state

Description Usage Arguments Value Note Examples

Description

This function produces a map with a plot of the location of all FARS incidents in a given state during a given year.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

An (integer) state identification number as listed in the FARS data files.

year

An integer value corresponding to the year for which the map should be plotted.

Value

a plot showing the location (latitude and longitude) of all FARS incidents, plotted on a map of the state identified by state.num during the specified year.

Note

This function will stop and return the message "invalid STATE number: state.num" if a state.num value that does not correspond to a state listed in the data file is input.

This funciton will stop and return the message "no accidents to plot" if there are no FARS incidents in the specified state during the specified year.

This function will result in an error if the year specified does not correspond to a FARS CSV file in the current working directory with the proper filename syntax (accident_YYYY.csv.bz2)

Examples

1
## Not run: fars_map_state(6, 2014)

expo45/wk4project documentation built on May 16, 2019, 9:56 a.m.