fars_summarize_years: Summarize the number of accidents in each month

Description Usage Arguments Details Value Examples

Description

This function takes a vector of strings or numerics representing which years will be summarized. The vector is passed to fars_read_years to create a list of dataframes.

Usage

1

Arguments

years

a vector of strings or numerics, each in "yyyy" format.

Details

The function then calls bind_rows to combine the dataframes into one. The single dataframe is then passed into group_by and summarize to obtain the total number of accidents each month.

Finally, the summarized dataframe is passed to spread to create a dataframe where the columns are each year, the rows are the months, and the values are the number of accidents each month for each year.

If years does not consist of strings or numerics representing the years to summarize, an error may result.

Value

a dataframe consisting of the number of accidents of each month, with the summarized years as the column names.

Examples

1
2
3
4
## fars_summarize_years(2015)

## years <- 2013:2015
## df <- fars_summarize_years(years)

alphaecho1229/Week4Assessment documentation built on May 12, 2019, 10:30 p.m.