Description Usage Arguments Value References See Also Examples
fars_summarize_years
reads one or more years of FARS accident data then summarizes a count
by month of the number of accidents. If a file is not found a warning is returned that the
year is not valid (if the file does not contain a column named MONTH and a column named
year the same warning is issued).
1 | fars_summarize_years(years)
|
years |
vector of one or more years of files to read |
a data frame with a column for the 12 months followed by a column for each year returned. The rows are the numeric month followed by a count of the accidents for that year and month so the table has at most 12 rows. For example, if years 2015 #' and 2016 are requested and there are 2371 accidents in 2015 and 2344 accidents in 2016, the data frame would have column names of 'MONTH', '2015' and '2016' and start something like this:
MONTH | 2015 | 2016 |
1 | 2371 | 2344 |
2 | 1983 | 2421 |
with additional rows for the remaining months
for more information on FARS data see https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars
make_filename
for the file nameing convention used
fars_read_years
for the file input
1 2 3 4 | ## Not run:
my_df <- fars_summarize_years(2015:2016)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.