This package is intended to extract information by year from different-years datasets from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes. Functions in this package make file names by year, and extract and summarise data in them.
This function takes a character or integer vector of length one of year as argument and returns the filename of accidents data corresponding to that year.
TestPackage::make_filename("2013")
This function takes a filename as a character vector of length 1, checks for the file's existence, and, if it exists, reads the data in file. Otherwise, fars_read throws an error.
This function takes a character or integer vector of years of any length, generates filename using make_filename and reads each file corresponding to the year using fars_read. For files that does not exists, it throws an error.
This function takes a character or integer vector of years of any length, uses fars_read_years, and returns tbl_df representing the summary of number of accients per month for each year.
This function takes a state number representing an American state and a year. It then plots the locations of accidents on map in a state.
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.