Fars package reads and plots in a map data from the Fatality Analysis Reporting System (FARS)
of the National Highway Traffic Safety Administration
library(Fars) library(maps) library(dplyr)
Data files included within the package are:
list.files(system.file("extdata", package = "Fars"))
make_filenameThis function returns file name and path based on the input year
yr <- 2014 make_filename(yr)
This function reads a file provided by the make_filename funtion
filename <- make_filename(2013) fars_read(filename)
fars_read_yearsFunction that will be used by the fars_summarize_years function
fars_read_years(2013)
fars_summarize_yearsThis function summarizes yearly accidents data, by year/month.
fars_summarize_years(2013:2015)
fars_map_stateThe function displays a state map plot including accidents location by year
state_num <- 51 # Virginia yr <- 2013 fars_map_state(state_num, yr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.