knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(FARSFunctions)
FARS is a nationwide census providing NHTSA, Congress and the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes. This package provides a set of 5 functions that help to analyse FARS dataset:
fars_read()
to read CSV file and convert to tibble data framemake_filename()
to construct file name using year
fars_read_years()
to consolidate fatalaties by month and yearfars_summarize_years()
to summarize fatalaties by month and yearfars_map_state()
to plot fatalities on map for gievn state and yearBelow code demonstrates examples of function usage:
fars_read(make_filename(2015)) fars_read_years(c(2013,2014,2015)) fars_summarize_years(c(2013,2014,2015)) fars_map_state(1,2015)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.