fars_read_years: Print "FARS Read Years"

Description Usage Arguments Value References See Also Examples

View source: R/fars_functions.R

Description

fars_read_years returns the month and year for each row (observation) in a series of FARS data files. Each data file contains data for one calendar year on fatal injuries suffered in motor vehicle accidents as compiled by the Fatality Analysis Reporting System (FARS) of the US National Highway Traffic Safety Administration. If the data file for a specified year is not found or is not in the proper format, a NULL value is returned.

Usage

1
fars_read_years(years, dir = "./inst/extdata")

Arguments

years

a list of years (each represented as 4-digit integers or character strings) for which data is desired

dir

a character string containing the directory that contains the FARS data

Value

The function returns a nested list of tibble data frames (class tbl_df, as defined by the dplyr package), one for each year. Each tibble data frame has two columns, MONTH and year.

References

https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars

See Also

fars_read, fars_summarize_years

Examples

1
2
3
4
dir <- system.file("extdata",package="msdr3pam")
y <- fars_read_years(c(2013,2014,2015),dir=dir)
y <- fars_read_years(c('2013','2015'),dir=dir)
y <- fars_read_years(list('2014','2015'),dir=dir)

mmiesch/msdr3pam documentation built on May 18, 2019, 9:14 p.m.