This vignette provides an example of how to use the hwcoursera package for fatality analysis reporting system database.

Main Info

The functions provided in this package will be using data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.

The main functions are:

Minimal example:

#cleaning the environment
rm(list = ls()) 

#set working directory with all the data
setwd("G:/accident_data")

#set library
library(hwcoursera)

#reading the 2013 database
name_db <- fars_read("accident_2013.csv")
class(name_db)

# if you want to create another file name and reading a zipped file
name_db_2014 <- make_filename("2014")
name_db <- fars_read(name_db_2014)
class(name_db)

#reading by year
fars_read_years("2015")

#reading and giving summarize information
fars_summarize_years("2015")

#map of the count of accidents in 2015 and the state number 1 
fars_map_state(state.num = "1", year = "2015")


adrHuerta/hw_coursera documentation built on May 10, 2019, 5:58 a.m.