fars
package reads and map Fatality Analysis Reporting System (FARS) data for states in US
from the National Highway Traffic Safety
Administration.
FARS is using 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.
library(fars) library(maps) library(dplyr)
Datafiles in the package are:
list.files(system.file("extdata", package = "fars"))
fars_read
read in a data file as a tibble named "data":
dat<-fars_read("accident_2013.csv.bz2")
make_filename
Make the filename like "accident_2013.csv.bz2", depend on the year.
make_filename(2013)
fars_read_years
fars_read_years(2013)
fars_summarize_years
Summarizes yearly accidents data, by month.
plot(fars_summarize_years(2015)) fars_summarize_years(c(2015, 2014))
fars_map_state
The function displays a state map plot showing the distribution. The state.num is between 1 to 56.
fars_map_state(34,2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.