README.md

Coursera's assignment on "Building R Packages" course

Travis-CI Build Status

Cousera FARS is a package that lets you:

data from the Fatality Analysis Reporting System. The final objective of this package is the final assignment for the course Building R Packages, part of the Mastering Software Development in R Specialization.

Data

First things first. You must have the FARS data to in order to use the package. I've included 2013 raw data in the "inst/extdata" folder, you can access to it with the \code(system.file) function:

system.file("extdata", "accident_2013.csv.bz2", package = "CourseraFARS")

Also you have an example of the output of the

Reading data

The FARS data is a annual compilation in CSV format. This packages provides functions to silently read data and return a tidy dataset. You can use the \code(fars_read) function to import a dataset, you only need to supply the filename parameter. See the \code(\link(fars_read)) function for more details. An example of the functionality:

library(CourseraFARS)

route <- system.file("extdata", "accident_2013.csv.bz2", package = "CourseraFARS")
dataset <- fars_read(route)

dplyr::glimpse(dataset)

Summarizing data

You can have a glimpse to how much observations by year-month occurred with the \code{fars_summarize_years} function, you only have to supply a integer vector with the years you want to analyze and it will return a wide format tibble with months on rows, years on columns and number of observations as values.

Visualizing data

Finally, you can map where most accidents occurred on a specific year and state with the \code{fars_map_state} function. It will draw a map with one point per accident.



JhossePaul/coursera_fars documentation built on May 8, 2017, 11:28 p.m.