fars_read_years: Retrieves Month & Year from the Accident Year Files

Description Usage Arguments Value Examples

Description

This is a simple function that takes a numerical list of integers that denotes years, accesses the accident file for each year of the list of years and return a list of dataframes of MONTH and year, one for each accident file, each associated with a year. The accident files for each year within list must be located within the current working directory and must be named in the format 'accident_<year>.csv.bz2'

Usage

1

Arguments

years

A list of integer numbers, each of which denote a year.

Value

Returns a list of dataframes/tibbles of months (under the column 'MONTH') and years (under the column 'year'). Each of these tibbles is associated with each accident file that is associated with each of the year elements of the list of years. If a year within the list does not have an associated file in the current working directory named in the format 'accident_<year>.csv.bz2', then a warning is thrown and returns NULL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
fars_read_years(2013)
fars_read_years(list(2013, 2014))
fars_read_years(2013:2015)

#A not-found warning is thrown and null is returned for the following
fars_read_years(list(2013, 2014, 2015, 2016))
fars_read_years(2017)

## End(Not run)

swethagarimalla/FARS documentation built on May 24, 2019, 7:16 a.m.