Description Usage Arguments Details Value Examples
View source: R/fars_functions.R
This function plots a map of a state showing the places of each accident that happend in the required year.
1 | fars_map_state(state.num, year)
|
state.num |
The state id of the required information. |
year |
The year of the required information. |
This function uses filter functions from dplyr package, map function from maps package and points function from graphics package. It also calls make_filename function in order to create a string with the filename, based on the year parameter and fars_read function to load the correspondent file with required year in a dataframe. In case of the year required doesn't have a correspondent file, it will stop running and print a message informing that there is no file for the year. In case of the state ID be invalid, it will stop running and print a message informing that the ID informed in the parameter is invalid. If there is no accidents to plot for state ID informed it will print a message to inform that.
This function returns a map of the state indicating the places of each accident that happend in the required year. It also return an error message if there is no file for the year informed in the parameter year or if the state id is invalid. If there no accident has happend in the informed state in the informed year, it will print a message to inform that there is nothing to plot.
1 2 3 4 5 6 | ## Not run:
fars_map_state(1, 2013)
fars_map_state(33, 2014)
fars_map_state(40, 2015)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.