Description Usage Arguments Details Value Examples
View source: R/fars_functions.R
fars_map_state
- Maps a given state's fatalities for a given year using the maps
package. If the state number or year are invalid given the current data, the function returns
the appropriate error message.
1 | fars_map_state(state.num, year)
|
state.num |
The two-digit state code of the area the user wants to map. State codes start from 01-51, and correspond to the alphabetical ordering of state names (e.g. 51 = Wyoming) |
year |
The year in which fatalities on the map will have occurred. |
The function uses other functions from this package to construct, for the given year,
The appropriate file. It reads in that file, and converts the state number to an integer. Next,
It checks to confirm the state code is valid. The data are trimmed to exclude values above 90 LAT
or 900 Long (those are considered data collection errors, since coordinates are not defined past
those thresholds). Lastly, the maps
package function map
is used to map the coordinates.
Returns a map object showing the locations of the fatalities for the given state-year
1 2 3 4 5 | ## Not run:
fars_map_state(04,2013)
fars_map_state(40,2014)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.