fars_read_years: Read FARS data files.

Description Usage Arguments Details Value Examples

View source: R/fars_functions.r

Description

This is a readr_csv function that reads a FARS data file given a relevaant year(s).

Usage

1

Arguments

years

A vector of integrs, or other types coerced to intgers, represent the years of the FARS data files.

Details

The function returns a warning invalid year: year if the input year does not correspond to one of the files in the current working directory. Otherwise, the function constructs a vecotr of file names using make_filename and reads them in a list using fars_read.

Value

A list of data.frames, each of its elements correspond to one of the given years.

Examples

1
2
3
4
5
6
7
8
## Not run: 
# invalid input, year does not exist
fars_read_years(c(2013, 2014, 3000))

# valid input, years exist
fars_read_years(2013:2015)

## End(Not run)

lakrobinson/fars documentation built on June 5, 2020, 12:33 a.m.