knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of fars is to provide some functions to analyse 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.
In the package there are 3 exemplificative files of how the data looks like and that can be used to have a better idea of how the functions work.
You can install the released version of fars from GitHub with:
install_github("veronicavedovetto/fars", build_vignettes = TRUE)
This is a basic example which shows you how to import one of the file with collected data and obtain a summary for the number of monthly accidents happened in two years:
library(fars) fars_summarize_years(2013:2014, demo = TRUE)
demo = TRUE
will tell the function to use the data provided with the package as an example.
If you want to use new downloaded data set it to FALSE (default value) and put the zipped files in the working directory.
You can also plot where accidents have happened with the following function:
fars_map_state(1, 2013, demo = TRUE)
You should indicate the number of the state and the year to be visualized.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.