fars_map_state: map FARS data by state and year

View source: R/fars_functions.R

fars_map_stateR Documentation

map FARS data by state and year

Description

map accidents by state and year with US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS)

Usage

fars_map_state(state.num, year)

Arguments

state.num

state from which the data will be displayed (number 1- 56)

year

, year from which the data will be displayed

Details

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.

Value

This function returns a graphical object.

Examples

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)


jmab20/farsfuncs documentation built on Feb. 25, 2025, 2:36 a.m.