fars_summarize_years: Count the number of accidents in FARS data over the years...

Description Usage Arguments Value References See Also Examples

Description

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).

Usage

1

Arguments

years

vector of one or more years of files to read

Value

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

References

for more information on FARS data see https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars

See Also

make_filename for the file nameing convention used
fars_read_years for the file input

Examples

1
2
3
4
## Not run: 
my_df <- fars_summarize_years(2015:2016)

## End(Not run)

jrwalker-projects/farsfunctions documentation built on May 29, 2019, 1:50 a.m.