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

This vignette gives a basic example of how to use the fars package.

library(fars)

To be able to read the files, they need to be provided in the following format accident_2013.csv.bz2, this format can be provided with the utility function make_filename as follows:

filename <- make_filename("2014")
filename

Loading the data set for the given year is provided by the fars_read function:

df <- fars_read(fars_example("accident_2013.csv.bz2"))
head(df)

The fars package also provides basic analysis functions:

fars_summarize_years(2014)

As well as the possibility to plot the accidents per state for a given year:

fars_map_state(5, 2014)


maximilian-muecke/fars documentation built on Jan. 5, 2022, 4:12 p.m.