knitr::opts_chunk$set( collapse = TRUE, eval=FALSE, comment = "#>" )
This vignette describes the step necessary to import and use FARS data.
There's not much to say about how to use it:
library(fars) # use sample fars file included in the package sample <- system.file("extdata", "accident_2014.csv.bz2", package = "fars") head(fars_read(sample))
In order to create a filename in the correct format, make_filename
function can be used:
library(fars) library(magrittr) file_2013 <- make_filename(2013) file_2013 <- paste0(system.file("extdata", package = "fars"), "/",file_2013)
The filename created above can be read using fars__read
function:
fars_read(file_2013)
Summary of fatalities as a function of month and year can be seen using fars_summarize_years
function:
fars_summarize_years(2013)
Fatalities for a given state and year can be seen on a map using fars_map_state
function:
fars_map_state(1, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.