fars_read_years: Import all files to a list of dataframes

Description Usage Arguments Details Value Examples

Description

This function takes a vector of years and returns a list of R tibble dataframes consisting of the files loaded. The function loops over the vector of years to load each of the Accident files on the directory whilst manipulating the data on them to create a new collumn "year" and select only the columns "MONTH" and "year".

Usage

1

Arguments

years

A character vector of years.

Details

The function uses fars_read function (fars_read) and make_filename (make_filename) to execute the described process.

If an invalid year is retrieved (i.e. if there is no file with the parsed year input), an error is retrieved.

This function uses dplyr package form tidyverse package repository.

Value

A list of R tibble dataframes.

Examples

1
2
3
4
5
## Not run: 
years <- c("2013","2014","2015")
fars_read_years(years)

## End(Not run)

joaocunha1991/AccidentR documentation built on May 27, 2019, 7:45 a.m.