knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
# library(dplyr) # library(readr) # ## basic example code # yr <- 2015 # data <- yr %>% # make_filename %>% # fars_read # head(data) # # fars_read_years("2013") # # plot(fars_summarize_years(2015)) # fars_summarize_years(c(2015, 2014)) # # fars_map_state(49, 2015)
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(peergradedassignmentdocumentingcode) library(maps)
fars
package reads and plots Fatality Analysis Reporting System (FARS) data from the National Highway Traffic Safety Administration.
FARS is a nationwide census, providing the American public yearly data, regarding fatal injuries suffered in motor vehicle traffic crashes.
Data files included within the package are:
list.files(system.file("extdata", package = "peergradedassignmentdocumentingcode"))
make_filename
This function returns file name and path to the data files:
make_filename(2014)
fars_read_years
Ancillary function used by fars_summarize_years
fars_read_years(2014)
fars_summarize_years
This function summarizes yearly accidents data, by month.
plot(fars_summarize_years(2013)) fars_summarize_years(c(2015, 2013))
fars_map_state
The function displays a state map plot including accidents location by year
state_num <- 26 # Michigan yr <- 2013 fars_map_state(state_num, yr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.