knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This package and the functions in it, use data from US National Highway Traffic Safety Administration's Fatality Analysis Reporting System. The purpose is to illustrate the correctness of the documentation and creation of a package. The purpose of the functions itself, is to show the accidents per state per country for each year, where each year corresponds to a separate dataset.
There are two generic functions:
fars_read
and make_filename
, which are just built for this special case to
load the zipped bz2 file to R and create the approriate name of the zipped file.
fars_read_years
and fars_summarize_years
fars_read_years
creates a dataset, containing the month and year information
for each observation. The fars_summarize_years
function takes the previous data
as a starting point and calculates the overview of the number of accidents per
month per year. The year corresponds to the dataset.
library(coursera) library(dplyr) fars_summarize_years(2013)
fars_map_state
Plot the overview of the locations of each accident in one state in one year.
fars_map_state(1,2013)
For more details of each function check their documentation.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.