library(fars) library(dplyr)
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Package for getting simple information from US National Highway Traffic Safety Administration's Fatality Analysis Reporting System. Contains next functions: fars_read, fars_read_years, fars_summarize_years, fars_map_state and make_filename.
First of all, you should load the data. You can do this in several ways. The first one is to use fars_read function.
fars_read('accident_2013.csv.bz2')
Also you can combine fars_read and make_filename functions to get the same result.
fars_read(make_filename(2013))
You can get small summary with first 'MONTH' column, and others depend on years input. Each year column shows number of rows for different months. See example below.
fars_summarize_years(c(2013,2014,2015))
The last one feature is the function prints map by state number, which shows all events on the road by year.
fars_map_state(5, 2014)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.