fars_read_years: Reads data for multiple years

Description Usage Arguments Details Value Note Examples

Description

fars_read_years is a function that reads Fatality Analysis Reporting System (FARS) data for multiple years.

Usage

1

Arguments

years

A vector of years.

Details

This function processes each element of a vector or list of years. To generate a file name with the year this function calls the supporting function make_filename(), and then calls the supporting function fars_read(), to read the FARS data file with the generated file name. If the file exists, the function creates a new column (year), then selects the month and year columns, and adds them to an R list.

Value

A list of FARS data for the years in the parameter years.

Note

If the file doesn't exit, the function gives a warning message, and adds nothing (NULL) to the list.

Examples

1
2
3
4
5
## Not run: 
fars_read_years(c(2014, 2015, 2016))
fars_read_years(c("2014", "2015", "2016"))

## End(Not run)

lahstorti/FARS.functions documentation built on May 15, 2019, 3:32 p.m.