fars_read_years: Read years and months from data files

Description Usage Arguments Details Value Examples

Description

The function reads data files based on a vector of years given. For each data file, it adds the year to the data frame as a new variable, and then extracts the MONTH, and year variables of the data frame.

Usage

1

Arguments

years

An integer number to be passed to the standard filename.

Details

The function uses lapply on the vector of arguments. For each element of the vector, it attempts to create a filename with make_filename(), read the file with fars_read(), add the year variable with dplyr::mutate(), and finally select the variables with dplyr:select(). fars_read() and the dplyr functions are wrapped in a tryCatch() function, which will print an error and return NULL when an element of the vector of years is invalid.

Value

The function returns a list of data frames.

Examples

1
2
3
4
## Not run: 
fars_read_years(2013)

## End(Not run)

IdleImpala/fars documentation built on May 3, 2019, 8:34 p.m.