fars_map_state: Plot accident locations on a map

Description Usage Arguments Value Examples

Description

This function attempts to output a polygon plot of a specific USA state with points ("." by setting pch to 46 in the points function) on the same plot indicating the location of all logged accidents within a specified year. It automatically assigns NA values to off-planet LAT/LONG combinations with the base R function is.na. The values xlim and ylim of link{map} is bound by the most outlying LAT/LONG points found within the data and subsequently the polygon drawn is clipped beyond these bounds.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

A number coerced to integer correspnding to an USA state.

year

A number representing the data for a specific year. This cannot be a vector. (It can, but things go wrong.)

Value

A plot combining polygons and points. If state.num is not found within the dataset selected with year, no plot is created and an error is returned. If the combination of state.num and year is valid, but there are no accident data, the function returns NULL, but not made visible in the console, while an appropriate message (not error) is displayed.

Examples

1
2
3
4
5
## Not run: 
fars_map_state(1,2015)
fars_map_state(54,2015)

## End(Not run)

supervan2/Testy documentation built on May 17, 2019, 2:47 p.m.