library(dplyr) library(maps) library(readr) library(tidyr) source("../R/fars_functions.R")
Building.an.R.package provides three categories of important functions regarding FARS: Reading in, Summarizing, and Plotting.
For reading the complete file use: fars_read. It reads a CSV file and creates a tibble from it. Specify the filename using the filename argument.
accident_2013 <- fars_read("accident_2013.csv.bz2") head(accident_2013)
The fars_read_years function returns a list of tibbles consisting of two columns: MONTH and year.
accident_2013_to_2015 <- fars_read_years(2013:2015) head(accident_2013_to_2015)
The fars_summarize_years function counts accidents for the specified years, grouped by months.
fars_summarize_years(2013:2015)
building.an.R.package is able to plot the FARS data for the specified state in the specified year using the fars_map_state function.
fars_map_state(1, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.