fars_map_state: Plot Fatality Analysis Reporting System (FARS) Data By State

Description Usage Arguments Value Note Examples

View source: R/fars_functions.R

Description

This is a function that takes an integer representing state.num and 4 digit year as input and FARS data into a data frames using make_filename and fars_read. The FARS data is filtered by state.num, and if the filter criteria does not exist in the dataset, the function will throw an error for invalid state. The filtered data will be plotted as a heat map where area with more accidents will be shown in darker spots. The function will give a message "no accident to plot" if there is no accident to report for the state and year.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

An integer of 4 indicating the state number. Valid values are 1 to 51, except 3

year

A 4 digit integer or string indicating the year

Value

This function does not have any return value, but it will plot it will plot a heat map of the accident for the given state and year.

Note

Though the function anticipates giving a message if no accident is reported for a state in a given year, there is a very good chance that this portion of the code will not be trigerred due to a check to ensure the state.num filter parameter is in the data set.

Examples

1
   ## Not run: fars_map_state(1,2015)

sbudiman/brpextravis documentation built on May 17, 2019, 8:44 p.m.