knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The Fars package provides function that can be used 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.
library(readr) library(magrittr) library(fars) library(maps)
Available data for the use of Fatality Analysis Reporting System.
list.files(system.file("extdata", package = "fars"))
This function reads a csv file and returns a tibble data frame.
make_filename(2013:2015)
This function plots a table with number of accidents per year and month.
setwd(system.file("extdata", package = "fars")) years <- c(2013, 2014, 2015) fars_summarize_years(2013:2015)
This function plots a graph for definded state with all accident locations.
setwd(system.file("extdata", package = "fars")) state_num <- 49 year <- 2014 fars_map_state(state_num, year)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.