knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This package provides convenient functions to extract, aggregate and visualise the Fatality Analysis Reporting System (FARS) data from the US National Highway Traffic Safety Administration, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.
You can install the package from GitHub using the install_github
function from devtools
as follows
library(devtools) install_github("Roger-Li/farsPackage") library(farsPackage)
data <- system.file("extdata", "accident_2013.csv.bz2", package = "farsPackage")
library(dplyr) library(readr) df <- fars_read(data)
The fars_summarize_years
function reads in a vector of files and returns the # of observation by month and year
library(tidyr) aggregated <- fars_summarize_years(c(2013, 2014, 2015))
fars_map_state
function is used to draw observations as points on a map
library(maps) library(graphics) fars_map_state(48, 2015)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.