knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
# I should underline that vignette is build automatically when your build your package. So, when development are finish, replace in the vignette devtools::load_all by library because your package is loaded before building the vignette when you build a package. #devtools::load_all(getwd()) library(farsAJS)
The farsAJS package offers several functions that make it easier to read, filter, summarise, and plot data for road accidents from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS).
filename returns the file name from the FARS data that contains the year specified by the user. To be used in combination with fars_read.
year<-c(2013) filename<-make_filename(year) filename
fars_read reads a csv file and converts it into a tbl_df table. It can be used in combination with filename.
ds<-fars_read(filename) head(ds)
fars_read_years reads one or more csv files, converts them into tbl_df tables, extracts year and month information from these tables and stores the result in a list object with one entry per year.
fars_read_years(2013) fars_read_years(2013:2015)[[2]]
fars_summarize_years reads one or more csv files, converts them into tbl_df tables, extracts year and month information from these tables, counts the number of observations per month for each year and stores the result in a tbl_df table with one column per year.
fars_summarize_years(2013:2015)
fars_map_state plots location data for a US state and year specified by the user.
fars_map_state(28,2014) fars_map_state(54,2015)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.