library(courserafars)
library(dplyr)
library(maps)

Intro

This document introduces you to the basics of this package. This packages provides a set of functions to analyze accident data files created by the National Highway Traffic Safety Administration NHTSA. The files record fatal motor vehicle accidents in the United States.

Summarizing Accidents

One main function of this package is to summarize accident data by month, across years. This is done with the fars_summarize_years() function, which takes a vector or list of years and outputs a comparison table. Note that the accident data files must be in the working director of the session.

setwd(system.file("extdata", package = "courserafars"))
fars_summarize_years(c(2013,2014))

Plotting Accidents

This package also allows you to visualize accidents in a given year in a given state. This is done through the fars_map_state() function. For instance, in the following example, we plot all of the accidents in Florida for the year 2014.

setwd(system.file("extdata", package = "courserafars"))
fars_map_state(12,2014)


milandv/courserafars documentation built on May 26, 2019, 6:36 a.m.