fars_summarize_years: Monthly count of accidents by year

Description Usage Arguments Details Value Examples

View source: R/fars_functions.R

Description

This function produces a monthly count of the number of accidents in the FARS database for each year given in years.

Usage

1

Arguments

years

A vector of four-digit years of the FARS data to load. Currently only data from 2013-2015 are available. years must be coerceable to an integer, or else an error will be generated.

Details

The FARS data can be found at the National Highway Traffic Safety Association here. 2013-2015 data is distributed with this package. The location of the files can be found using system.file('extdata',package='FARScoursera') These files need to be in your working directory for this function to work correctly.

Value

This function returns a dplyr tibble with the month in rows and the year in columns. The entries are the total number of accidents in that year / month. If years is a mix of valid and invalid years, the tibble is still returned by with warnings. If years does not contain any valid years, then an error is thrown

Examples

1
2
## Not run: fars_summarize_years(c('2013','2014'))
## Not run: fars_summarize_years(2013:2014)

jmmark/FARScoursera documentation built on May 19, 2019, 1:54 p.m.