knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Packages to be loaded
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE) library(fars) library(dplyr) library(tidyr) library(magrittr) library(maps) library(graphics) library(readr) library(tibble)
To read files or path from the system into the package. Error occurs if filename does not exist
accident_2013 <- system.file("extdata", "accident_2013.csv", package = "fars")
usage: fars_read(filename = accident_2013)
To create filename for a particular year
usage: make_filename(2013)
In order to create a dataframe containing list of years and month from the file imported PS: returns NULL if year is invalid
usage: fars_read_years(years = c(2013,2014,2015))
In order to reduce data to a yearly time step library(dplyr)
usage: fars_summarize_years(years = c(2013,2014,2015))
In order to create a map plotted with latitude and longitude for different state per year using unique state number Ps: error occurs if state number is invalid and returns NULL if state number == 0
usage: fars_map_state(6, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.