fars_map_state: State Accident Mapping

Description Usage Arguments Details Value Note Examples

View source: R/fars_functions.R

Description

This function takes years and a state number and plots the accident locations within that state.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

A state number from the alphabetical list of states.

year

The year from which you want to draw data.

Details

The function uses make_filename and fars_read_years to pull data from the Fatality Analysis Reporting Spreadsheet for the given years. It then checks to ensure the chosen state number is valid and that there were fatal accidents in that state for the given year. If there were, it uses the maps and graphics packages to plot the locations of those accidents along with a rough outline of the state's boundaries.

Value

This function, even when successfully run, returns NULL invisibly. However, it generates a plot in the course of running.

Note

These examples plot the accidents from Alabama in 2014 and Arkansas in 2013, respectively.

Examples

1
2

alexmjn/advancedr documentation built on May 29, 2019, 5:57 p.m.