library(Assignment3.2.1) library(dplyr) library(maps)
This vignette gives an overview of the Assignment3.2.1. The package is designed to analyze FARS data.
Following are exported functions:
fars_read()
fars_summarize_years()
fars_map_state()
For example purpose data on FARS can be found in \extdata
folder.
The function fars_read()
can be used to read from a csv file.validates the file path and abort the process if the path is incorrect with an error message. This function returns a data frame of records.
filename <- system.file("extdata/accident_2013.csv.bz2", package = "Assignment3.2.1") fars_read(filename)
The function fars_summarize_years()
takes a list of years and based on the data, a summary of accidents occured in a given month and year is prepared. The input file should be present in data folder inside working directory.
setwd(system.file("extdata", package = "Assignment3.2.1")) fars_summarize_years(2013:2015)
The function fars_map_state()
helps to plot the accident hit location on map. It takes two input the satate number and year.
setwd(system.file("extdata", package = "Assignment3.2.1")) fars_map_state(45, 2015)
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.