fars_read_years: Reads data from a compressed file based on a specific year.

Description Usage Arguments Value Warning Examples

View source: R/fars_functions.R

Description

For the data provided by the US National Highway Traffic Safety Administration in the Fatality Analysis Reporting System, fars_read_years will read the data for a specific period, and it will return a variable (MONTH) in the dataset.

Usage

1

Arguments

years

A numeric vector representing the years of a time period.

Value

A tibble object with the data of car fatalities by month for each year in the specified period.

Warning

Provided that a file does not exist for a specific year, the function will throw a warning that the information was not read.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# We set the working directory where the compressed files are stored within
# the package.
## Not run: 
WD0 <-getwd()
setwd(system.file("extdata", package = "fars"))
# Data with the car fatalities in 2013.
fars_read_years(2013)
# Data with the car fatalities in 2013 and 2014.
fars_read_years(c(2013, 2014))
setwd(WD0)

## End(Not run)

arnaudmilet/fars documentation built on May 26, 2019, 1:31 a.m.