Description Usage Arguments Details Value Examples
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.
1 | fars_summarize_years(years)
|
years |
a vector of strings or numerics, each in "yyyy" format. |
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.
a dataframe consisting of the number of accidents of each month, with the summarized years as the column names.
1 2 3 4 | ## fars_summarize_years(2015)
## years <- 2013:2015
## df <- fars_summarize_years(years)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.