fars_map_state: Generate a map of a state in a specific year of locations...

Description Usage Arguments Value Examples

View source: R/fars_functions.R

Description

This function generates a scatter plot map where x and y axes are defined by longitude and latitude of a state (according to state.num) in a specific year to reflect the location of accidents. If the state cannot be found in the dataset, the function halts and throws an error message. If there is no accidents in the state for the given year, the function returns NULL with a message "no accidents to plot".

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

A string that can be used to find the state of interest in the data frame.

year

A string that can be used to find the file of the specific year.

Value

This function returns NULL if no accidents occurred in the state during the given year. Otherwise, it returns a scatter plot that highlights the locations defined by longitude and latitude of accidents occurred.

Examples

1
2
## Not run: fars_map_state("13", "2014")
## Not run: fars_map_state("0", "2013")

yecong/accdata documentation built on May 5, 2019, 11:01 p.m.