fars_map_state: FARS map states.

Description Usage Arguments Details Depends on Examples

View source: R/fars_functions.R

Description

Plots on a USA State map the fatal injuries suffered in motor vehicle traffic crashes for the requested year and state.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

The State identifier as an integer or a character .

year

A vector containing the years of interests as integer or character.

Details

This function performs the steps below:

  1. Build the FARS file name from year (using make_filename).

  2. Read the FARS data file in R as a data frame tables (using fars_read).

  3. Plot on a USA State map all the incidents related to the selected State (state).

If the provided state is not valid then execution is stopped and an error is returned.

If the provided state is valid and does not have any incidents then execution is stopped and a message is returned.

Depends on

  1. filter in the dplyr package.

  2. map in the maps package.

  3. points in the graphics package.

Examples

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

## End(Not run)

pparacch/fars documentation built on May 6, 2019, 6:01 p.m.