fars_read_years: Generates a list of fatalities

Description Usage Arguments Details Value Note Examples

View source: R/fars_functions.R

Description

The function generates a list summarising the number of fatal traffic accidents recorded in the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS). Each file imported (representing data for a specific year) will be represented as a tibble with column headings of Month and Year.

Usage

1

Arguments

years

A vector (or matrix) used to represent the years of the data files to be imported.

Details

The function iterates over each year using lapply to import the files created using the make_filename() function supplied in this package. The mutute and select functions from the dplyr package are also used to generate the required output.

Value

A ist with each element containing the Month and Year for each dataset imported. A warning message, "invalid year: xxxx" will be displayed if the file does not exist.

Note

A package permitting the use of pipelines ( The dplyr package must be installed in the R environment but does not have to be attached.

Examples

1
2
fars_read_years (2014)
fars_read_years(c(2013,2015))

gben1750/fatal-car-analysis-reporting-system documentation built on Dec. 20, 2021, 9:49 a.m.