knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
devtools::load_all()

Introduction

This package allows to summarise and plot US accident data through two main wrapper functions:

The package comes with a couple of helper functions that enable you to read accident files from several years. They are also used under the hood of the two main wrapper functions.

Summarize Years

fars_summarize_years() uses fars_read_years() under the hood to read data of all years specified and then counts the number observations per month.

# Summarise Multiple Years
fars_summarize_years(years = c("2013", "2014", "2015"))

Plot Accidents of a State

fars_map_state() uses make_filename() fars_read() under the hood to create and read the path of the csv for the specified year. A state of interest needs to be selected via argument state.num and then the accidents of this state are plotted on a map. Below the accidents for state number "13" in 2013 are plotted.

# Summarise Multiple Years
fars_map_state(state.num = 13, year = "2013")


olivenbert/mypkg documentation built on May 25, 2019, 2:21 p.m.