knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(farsCoursera)
library(maps)
file_list <- list.files(system.file("extdata", package = "farsCoursera"))
from <- lapply(file_list, function(f) {
    file.path(system.file("extdata", package = "farsCoursera"), f)
})
to <- getwd()
lapply(from, function(f) {
    file.copy(f, to)
})

farsCoursera

Build Status

Overview

This package allow you to import and summarize data from the Fatality Analysis Reporting System. You can also map the locations of accidents on a state map.

Installation

You can install this package directly from GitHub.

install.packages("devtools")
devtools::install_github("JayLKim/farsCoursera")

Usage

We need to assume that we already have downloaded a data file at the current working directory.

If you input a vector of years, you can get a tibble of all cases.

fars_read_years(c(2013, 2014))

This function summarizes the data you imported. It returns a tibble representing the number of cases per month for a given year.

fars_summarize_years(c(2013, 2014, 2015))

You can map the locations of accidents on a state map. Let's draw an accident map of Florida in 2013. (See this link for a state.num)

fars_map_state(state.num = 12, year = 2013)


JayLKim/farsCoursera documentation built on May 7, 2019, 10:33 a.m.