Description Usage Arguments Details Value Examples
This function makes use of the geographic data contained in FARS accident data sets to plot accidents on maps of US states.
1 | fars_map_state(state.num, year)
|
state.num |
The numeric code (as numeric or integer) of the US state to be analysed. Numeric codes can be found e.g. on Wikipedia. |
year |
The year (as numeric or integer) from which the data is to be plotted. |
The function internally uses the make_filename
and fars_read
functions to read in the FARS data for the given year and than filters for the given state.
The geographic data is extracted and plotted using the maps
package.
The function returns a plot with a graphical representation of the selected US state with the
accidents of the indicated year plotted as dots on the map according to their geographic
location. If the data set contains no accidents for the indicated year and state,
the message "no accidents to plot"
is printed to the console and if an invalid
state number is given as input, a warning will be displayed.
1 | ## Not run: fars_map_state(31,2015) #Plot all accidents that happened 2015 in Nebraska.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.