View source: R/fars_functions.R
fars_map_state | R Documentation |
map accidents by state and year with US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS)
fars_map_state(state.num, year)
state.num |
state from which the data will be displayed (number 1- 56) |
year |
, year from which the data will be displayed |
it is necessary to download the fars files before, this functions read the files from the working directory, if not an error will be thrown Throws an error of "invalid State Number:" for invalid state number.
This function returns a graphical object.
library(dplyr)
library(readr)
library(tidyr)
library(maps)
library(graphics)
f13path<-system.file("extdata", "accident_2013.csv.bz2", package = "farsfuncs")
file.copy(from=c(f13path),to=getwd())
fars_map_state(1, 2013)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.