fars_map_state: Plot State Level Accidents (Geo-Plotting)

Description Usage Arguments Details Value Examples

Description

This function takes a State Number (state.num) and a Year (year) to import a file (based on the year parsed) as a R tibble dataframe. After filtering the dataframe based on State Number (state.num), the function outputs a geo-plot of the filtered State Number (state.num) with the volume of accidents.

Usage

1
fars_map_state(state.num, year)

Arguments

state.num

A character variable representing the State Number reference to use to plot the volume of accidents.

year

A character variable representing the year of the file to import.

Details

The function uses fars_read function (fars_read) and make_filename (make_filename) to execute the described process.

If State Number (state.num) doesn't exist on the dataframe an error is returned (i.e. invalid STATE number: 324). If the filtered dataframe has zero records - the function returns a message 'no accidents to plot'.

Longitudes higher than 900 and Latitudes > than 90 are treated as NAs for plotting purposes.

Value

A geo-plot of the State Number (state.num) with the volume of accidents.

Examples

1
2
3
4
## Not run: 
fars_map_state(state.num = "6", year = "2015")

## End(Not run)

joaocunha1991/AccidentR documentation built on May 27, 2019, 7:45 a.m.