The fars package analyses data 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.

Summarize accidents

If you are interested in the number of accidents per month and year, you can count them with the fars_summarize_years function. You only need to provide the years of interest. The function will create the filenames using the make_filename function, read in the files from your current working directory using the fars_read function, and finally summarize the data.

require("knitr")
require("fars")
opts_knit$set(root.dir = system.file("extdata", package = "fars"))
fars_summarize_years(2013:2015)

Map accidents

In order to display the point locations of accidents for a given state state.num and year, you can use the fars_map_state function.

fars_map_state(39, 2013)


la-sch/fars documentation built on May 20, 2019, 7:31 p.m.