knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
fars
package reads and plots Fatality Analysis Reporting System (FARS) data
from the National Highway Traffic Safety
Administration.
FARS is a nationwide census, providing the American public yearly data, regarding fatal injuries suffered in motor vehicle traffic crashes.
library(fars) library(maps) library(dplyr) library(fars)
The data files included within the package are:
list.files(system.file("extdata", package = "fars"))
make_filename
This function creates a filename from on a chosen year.
make_filename(2015)
fars_read_years
This function create a list for each specified year containing a tibble with month and year columns referred to a fars_read file. It also check if there is data for the selected year.
years <- c(2013,2014,2015) fars_read_years(years)
fars_summarize_years
The function return a tibble summarizing the number of observations for each month in the selected years.
years <- c(2013,2014) fars_summarize_years(years)
fars_map_state
The function returns a map with incidents' coordinates or NULL in case of no accidents.
fars_map_state(1,2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.