The FARS package allows the analysis of data from the US National Highway Traffic Safety Administration's (Fatality Analysis Reporting System).
This R package is available on Github and can be installed and used by typing those commands:
devtools::install_github("https://github.com/llangevin/FARS") library(countytimezones)
There are 3 functions that can be utilized for the analysis:
- fars_read()
- summarize_years()
- fars_map_state()
The function "fars_read()" reads a csv file of the accidents and generate a tibble file than can be used to analyse the data with R functions.
data <- fars_read(filename = "./accident_2013.csv.bz2")
The function "summarize_years()" produce a summary of the accidents per year(s) for each month.
summarize_years<-fars_summarize_years(years=2013:2015)
The function "fars_map_state()" allows to see the accidents location on a map of the choosen state and year.
fars_map_state(40, 2014)
The accidents data for years 2013 to 2015 are available in the package "inst/extdata".
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.