knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(myRpackage)
This package contains functions for reading, summarizing and visualizing the \href{Fatality Analysis Reporting System (FARS)}{https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars} data.
Note: for any of these functions to work, the FARS data must be located in your current working directory.
The \code{fars_read} function accepts a single argument, \code{filename}, which is a path to the FARS .csv file.
This example uses the sample data contained in the package.
filename <- system.file("extdata", "accident_2013_sample.csv", package="myRpackage", mustWork=TRUE) fars_2013 <- fars_read(filename)
The \code{fars_summarize_years} function takes a vector of integers years and returns the total number of accidents for each month for a given year.
fars_summarize_years(c(2013, 2014))
The \code{fars_map_state} function takes two integer arguments, \code{state} and \code{year} for the state number.
fars_map_state(5, 2014)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.