fars_read_years: Read multiple file names

Description Usage Arguments Details Value Examples

View source: R/fars_functions.R

Description

This function takes a vector of numeric values and read their corresponding file names into a tibble.

Usage

1

Arguments

years

a numeric vector containing four-digit numeric values.

Details

fars_read_years first takes a numeric vector containing four-digit elements. It then calls make_filename to turn every elements of years vector into a character vector of formatted file names. The file names are used to read the corresponding date files into tibbles. for the purpose of error handling the function callstryCatch in order to check whether the provided file name can be evaluated and read into tibble or not. In case an invalid year name is provided an error will be thrown.

Value

A list with length equal to the length of numeric vector years in case year names are correctly provided. Elements of the list are tibbles containing 2 columns, month and year.

Examples

1
2
3
4
## Not run: 
fars_read_years(c(2013, 2014, 2015))

## End(Not run)

AnoushiravanR/fars documentation built on Jan. 19, 2021, 5:16 p.m.