Description Usage Arguments Value References See Also Examples
View source: R/fars_functions.R
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.
1 | fars_read_years(years, dir = "./inst/extdata")
|
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 |
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.
https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars
fars_read
, fars_summarize_years
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.