FARS package is a cluster of functions that can handle information about Fatality Analysis Reporting System (FARS) which is provided by US National Highway Traffic Safety Administration through a file. Each file has the information about a specific year.
Below is a list of all functions with its short description.
source("../R/fars_functions.R") library(dplyr)
fars_read: Loads a specific fars file to a data frame
df_fars_file <- fars_read("accident_2013.csv.bz2") head(df_fars_file)
make_filename: Builds a string with the name of file that will be loaded based on the year given by the user
filename <- make_filename(2013) filename
fars_read_years: Creates a list of all months in the files
setwd(system.file("extdata", package = "fars")) list_of_months <- fars_read_years(c(2013, 2014, 2015)) head(list_of_months)
fars_summarize_years: Summarizes the number of occurrencies in each month by year
setwd(system.file("extdata", package = "fars")) df_occurrency_summary <- fars_summarize_years(c(2013, 2014, 2015)) head(df_occurrency_summary)
fars_map_state: Plots a map of a state showing the places of each accident that happend in a specific year
setwd(system.file("extdata", package = "fars")) fars_map_state(1, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.