This is an example vignette for the course "Mastering Software Development in R".
The functions in this package use 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. Data was provided in the form of files for each accident year (e.g., "accident_2013.csv.bz"). Source data is at https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars
These functions are mainly for internal use by the package:
fars_read
: Reads in FARS data to a data framemake_filename
: Makes a file name according to the FARS data standard given the year.fars_read_years
: Reads in the month & year for each accident from a FARS data file for multiple years.These functions produce output summarizing the FARS data:
fars_summarize_years
: Summarizes the number of accidents per month and year for given years.fars_map_state
: Plots the number of accidents using per state given yearThis example below is producing a table with accidents by month for 2014 and 2015
library("courseraMasterR") library("magrittr") library("tidyverse") fars_summarize_years(2014:2015)
This shows how the package can be used to compare the location of accidents in West Virginia for 2014 and 2015
library("maps") library("courseraMasterR") fars_map_state(21,2014) fars_map_state(21,2015)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.