Description Usage Arguments Value Note Examples
View source: R/fars_functions.R
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.
1 | fars_map_state(state.num, year)
|
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 |
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.
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.
1 | ## Not run: fars_map_state(1,2015)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.