knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette provides an overview of the farsdata package. This package consists of 3 main and 2 helper functions designed to make using the Fatality Analysis Reporting System a little easier
the 3 main functions are the following
fars_read_years()
fars_summarize_years()
fars_map_state()
"fars_read_years" allows you to read the csv data for one or more years. The data is returned as a summarized list with one dataframe per input year. Invalid years or years with no value will return NA as that list element
setwd(system.file("extdata", package = "farsdata")) data <- fars_read_years(c(2013,2014))
"fars_summarize_years()" takes a vector of the years to query and returns a dataframe consisting of summarized monthly data by year
setwd(system.file("extdata", package = "farsdata")) data <- fars_summarize_years(2013:2015)
"fars_map_state()" takes the summarized data and returns a plot for a given state index and year. The index must map to an index in the dataset
setwd(system.file("extdata", package = "farsdata")) data <- fars_map_state(5,2014)
The datafile needs to be available in the extdata path in the project
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.