fars_map_state: Plot FARS observation locations within a state

Description Usage Arguments Value Examples

View source: R/fars_functions.R

Description

This function plots a map of the specified state and the location of each observation in the FARS data for a specified year.

The function will return a message if there were no accidents for the specified state and year.

Note: The function will return an error if the specified state.num is not valid. Additionally, some state numbers, for example "2", cause an error due to specified plot regions being out of bounds.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

An integer or character string of an integer specifing which state to plot. An error will be thrown if an invalid state number is specified.

year

An integer or character string of an integer specifying the year for which to plot the accidents.

Value

If there is data for the specified state and year, the function will plot a map of the state and the locations of the accidents for that year. If there are no recorded accidents for that year and state then the function will return a message to notify that case.

Examples

1
2
3
4
5
6
7
8
## Not run: 
fars_map_state(13, 2013)
fars_map_state(13, "2013")
fars_map_state("13", 2013)
fars_map_state("13", "2013")

## End(Not run)
  

xamontalvo97/Curso-3 documentation built on May 21, 2019, 9:39 a.m.