Description Usage Arguments Details Value Note See Also Examples
View source: R/fars_map_state.R
fars_map_state
takes a numerical vector corresponding to the state whose
data will be plotted and the year when the data occurred. For this function to
work, data should be in .csv.bz2 format located in the same directory as the
working directory. In case the data for a particular year is unavailable, the
function will show an error message for the year that was not available.
1 | fars_map_state(state.num, year)
|
state.num |
A numerical vector corresponding to a particular state in the USA. |
year |
A numerical vector corresponding to a particular year. |
If you have a file from FARS that is in .csv format but not in .csv.bz2 format, you can convert it to .csv.bz2 format by using the write.csv function in R. See vignette "Other functions in readFARS".
A plot of the map of the state of interest with points on the map indicating traffics fatalities occurred.
In case the chosen numerical vector does not correspond to a particular state, the function will stop and show an error message. The numbers 3, 7, 14, and any number above 56 will result in an error. In case, there are no traffic accidents for that particular year or state, a message will appear stating there are no accidents to plot.
1 2 | fars_map_state(2, 2013)
fars_map_state(2000, 2013)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.