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.

Function Info

Generic functions

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.

Example for number of accidents per month per year in the US
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.

Example plot for state 1 in year 2013
fars_map_state(1,2013)

Details

For more details of each function check their documentation.



alex2905/coursera documentation built on May 17, 2019, 8:04 a.m.