fars_map_state: Draws observations as point on a map

Description Usage Arguments Details Value Warning Note Examples

View source: R/fars_functions.R

Description

fars_map_state takes a State number and a year as arguments. Reads the corresponding file and draws a map of the acccidents using longitude and latitude for that the state.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

a state number, an integer between 1 and 56.

year

a year, as integer.

Details

If the value for the state.num parameter does not correspond to a valid state in the dataset, the function will throw an error. If the state and year combination has none observations, a message is printed. All the points outside of Longitude > 900 or Latitude > 90 are nullified and not drawn on the map.

Value

NULL (empty) returned invisibly invisible. As side effect, the function will draw a map of accidents/observations.

Warning

maps package should be attached (library(maps)), or the function will throw an error because maps does not export the data (object 'stateMapEnv') for the map function.

Note

The data files must be in the current working directory (see also getwd) to be found.

Examples

1
2
fars_map_state(1, 2013)
fars_map_state(48, 2015)

Roger-Li/farsPackage documentation built on May 25, 2019, 1:28 p.m.