FARS is a nationwide census providing NHTSA, Congress and the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.
The data files are in CSV format, often compressed. Function could read CSV and BZ2 files as well.
It has 50 variables=columns (eg. STATE, CITY, COUNTY, DAY, MONTH, YEAR, FATALS etc.), and around 30k records.
This html_vignette
for FARS package shows basic usage of the functions provided.
devtools::install_github("krzyklo/fars")
This package provides 5 R language functions for working with FARS data:
Below we could see the location of the FARS file attached to this package.
library("fars") fars2013_path<-system.file("extdata","accident_2013.csv.bz2",package = "fars") fars2013_path getwd()
Function fars_summarize_years()
shows summary for given years for each month in table.
setwd("../inst/extdata") knitr::kable(fars_summarize_years(2013))
Summary of fatalities for each month of 2013 year.
Function fars_map_state
shows accidents locations on the map:
setwd("../inst/extdata") fars_map_state(1,2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.