Description Usage Arguments Details Value Note Examples
View source: R/fars_functions.R
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.
1 | fars_read_years(years)
|
years |
A vector (or matrix) used to represent the years of the data files to be imported. |
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.
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.
A package permitting the use of pipelines ( The dplyr package must be installed in the R environment but does not have to be attached.
1 2 | fars_read_years (2014)
fars_read_years(c(2013,2015))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.