fars_read_years: Extract month and year variables from several Traffic Safety...

Description Usage Arguments Value Note Examples

Description

This function constructs a list of tibbles containing the month and year variables for each year (one list element per year) for a set of years (e.g. 2013:2015).

Usage

1

Arguments

years

A vector of year values in %Y format, e.g., 2014, or 2013:2015

Value

A list containing the month an year variable for each of the years of the Traffic Safety Administration's Fatality Analysis Reporting System datasets

Note

The data for each year should be in format "accident_<year>.csv.bz2". If a file for a given year is not found a warning is printed out and the list element for that year is NULL. This function uses make_filename to construct the filename to the dataset and fars_read to load the dataset as a tibble.

Examples

1
2
fars_read_years(2015)
if (any(file.exists(make_filename(2013:2015)))) {fars_read_years(2013:2015)}

ValeriVoev/VRVPackage documentation built on May 30, 2019, 9:41 p.m.