knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" ) library(farsCoursera) library(maps) file_list <- list.files(system.file("extdata", package = "farsCoursera")) from <- lapply(file_list, function(f) { file.path(system.file("extdata", package = "farsCoursera"), f) }) to <- getwd() lapply(from, function(f) { file.copy(f, to) })
This package allow you to import and summarize data from the Fatality Analysis Reporting System. You can also map the locations of accidents on a state map.
You can install this package directly from GitHub.
install.packages("devtools") devtools::install_github("JayLKim/farsCoursera")
We need to assume that we already have downloaded a data file at the current working directory.
fars_read_years()
)If you input a vector of years, you can get a tibble
of all cases.
fars_read_years(c(2013, 2014))
fars_summarize_years()
)This function summarizes the data you imported. It returns a tibble
representing the number of cases per month for a given year.
fars_summarize_years(c(2013, 2014, 2015))
fars_map_state()
)You can map the locations of accidents on a state map. Let's draw an accident
map of Florida in 2013.
(See this link
for a state.num
)
fars_map_state(state.num = 12, year = 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.