knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(dplyr) library(readr) library(tidyr) library(maps) library(graphics) library(week2)
This package is intended to be used for getting some information on USA motor crashes.
The user can use the following function:
This function gets as input a list of years, and gives a summary of how many motor crashes there were in each month of each year in USA (taken from relevant files for those years).
years: A vector of the years to be read.
This function returns data frame with a "MONTH" column, and one columns per each year in the "years" input argument. The values under each year column - is the number of motor crashes that happeded in that year - for this specific month.
For example:
fars_summarize_years(c(2013,2014))
This function gets as input a state number (in USA) and a year. Its output is a map of this state with points located at the geographical location of motor crashes that happened in that state in that year. Note that invalid year (where no file exists for that year), or invalid state number will give an appropriate error.
state.num: The state number in USA.
years: A vector of the years to be read.
This function returns a map of the specific state with all motor crash locations That happened in the specific year in that state. All data is taken from relevant file. For example:
fars_map_state(1,2014)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.