knitr::opts_chunk$set(collapse = TRUE,echo=TRUE)
library(fars)
The functions in this package use data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System and produce summary statistics and map visualizations. Sample data can be downloaded here:
https://d3c33hcgiwev3.cloudfront.net/e1adac2a5f05192dc8780f3944feec13_fars_data.zip?Expires=1553990400&Signature=WETh6sqM548wWMwbOTYisEj~BMR6SAYHu3eY9iLL5j~3oxH5cXQWBqcXy7lZiCjLH-I41skDlSesw~s-DKZtlSywmTcdr6lTxbqM-EMP5Sj5QRJp8dNWdtuEc6TTjQiwN3scMKGO3ePnN1iG3WL1kyxgjf-nzPhAnWvBHQPL-l4&Key-Pair-Id=APKAJLTNE6QMUY6HBC5A
Download the data files from the link above and extract them into your working directory. This is important, the functions only work if the extracted .csv.bz2 files are in your working directory.
Let's produce a summary of the years 2013,2014,2015.
fars_summarize_years(c(2013,2014,2015))
It would be interesting to see the accidents on a map. Let's print accidents for 2013 in California, USA.
fars_map_state(6,2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.