knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

This package contains a set of functions to analyze fars data. This vignette will discuss the use of each of the avialble function.

Create filenames from year input

In order to create a filename in the correct format, make_filename function can be used:

library(fars)
library(magrittr)
file_2013 <- make_filename(2013)
file_2013 <- paste0(system.file("extdata", package = "fars"), "/",file_2013)

Reading the file

The filename created above can be read using fars__read function:

fars_read(file_2013)

Data summary

Summary of fatalities as a function of month and year can be seen using fars_summarize_years function:

fars_summarize_years(2013)

Map of fatalities

Fatalities for a given state and year can be seen on a map using fars_map_state function:

fars_map_state(1, 2013)


pchhina/fars documentation built on May 5, 2019, 3:54 p.m.