knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette will walk you through loading the Fatality Analysis Reporting System (FARS) datasets and performing a basic analysis.
The function fars_read_years return a list of tibbles for the vector of years specified. Each fatality results in one row in this tibble.
library(fars) fars_read_years(c(2013, 2014))
The fars_summarise_years
function provides the count of fatalities for the years.
fars_summarize_years(c(2013,2014))
The fars_map_state
function plots the fatalities for a given state and year on the map using the geo coordinates of the accident. The following is the map for the state of Alabama. The index of state is in alphabetical order. It can be found using the base state.name
.
fars_map_state(1, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.