fars_map_state: Plot FARS data to a state map.

Description Usage Arguments Details Value Examples

View source: R/fars_functions.r

Description

This function plots individual FARS accidents' coordinates as points on a given state's map.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

An intger represents an identifier for a state.

year

An integer, represents the year of the FARS data file.

Details

The function returns an error invalid STATE number: state.num if the provided number does not correspond to a STATE in the data of the given year. The function returns a message no accidents to plot if the number of accidents for the given year and state comination is 0. Otherwise, it constructs a file name using the provided year, reads the data file and plots points of individual accidents on the STATE map.

Value

This function creates a plot of a state from map and plots points corresponding to the coordinates of recorded accidents.

Examples

1
2
3
4
## Not run: 
fars_map_state(49, 2013)

## End(Not run)

lakrobinson/fars documentation built on June 5, 2020, 12:33 a.m.