knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette gives a basic example of how to use the fars
package.
library(fars)
To be able to read the files, they need to be provided in the following format
accident_2013.csv.bz2
, this format can be provided with the utility function
make_filename
as follows:
filename <- make_filename("2014") filename
Loading the data set for the given year is provided by the fars_read
function:
df <- fars_read(fars_example("accident_2013.csv.bz2")) head(df)
The fars
package also provides basic analysis functions:
fars_summarize_years(2014)
As well as the possibility to plot the accidents per state for a given year:
fars_map_state(5, 2014)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.