knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The fars
package analyses data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.
If you are interested in the number of accidents per month and year, you can count them with the fars_summarize_years
function. You only need to provide the years
of interest. The function will create the filename
s using the make_filename
function, read in the files from your current working directory using the fars_read
function, and finally summarize the data.
require("knitr") require("fars") opts_knit$set(root.dir = system.file("extdata", package = "fars"))
fars_summarize_years(2013:2015)
In order to display the point locations of accidents for a given state state.num
and year
, you can use the fars_map_state
function.
fars_map_state(39, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.