fars_read_years: Read multiple years of motor vehicle crash data

Description Usage Arguments Value Examples

Description

This function (fars_read_years) accepts a vector of years or a single year as input. Each element of the input vector is treated separately and a list of data frames is returned. The year is converted to a filename using the make_filename function from this package (make_filename). The file is then read using the fars_read function from this package (fars_read). A column containing year is set to the year value contained in the filename using the mutate function from the dplyr package (mutate). Only the MONTH and year columns for each file are returned by using the select function from the dplyr package (select). A warning message is returned if a file does not exist.

Usage

1

Arguments

years

A string or integer vector giving the years of motor vehicle crash files to read in.

Value

This function returns a list of data frames if the motor vehicle crash year file exists. An warning message is returned if a file does not exist in the current directory.

Examples

1
2
3
4
5
6
7
8
## Not run: 
fars_read_years(2013)
fars_read_years(c(2013, 2014))
fars_read_years("2013")
fars_read_years(c("2013", "2014"))
fars_read_years(years=2013)

## End(Not run)

drsmd23/Fars documentation built on May 15, 2019, 2:54 p.m.