fars_summarize_years: Summarize monthly observations of fars data by year

Description Usage Arguments Value Examples

Description

This is a function to summarize multiple dataframes, each representing a year. The summary output is returned as a dataframe, containing number of monthly observations for each year. Given a vector of years parameter, the function begins with reading multiple years of data using another function (fars_read_years(years)) included in this package.Next, the function also uses 'dplyr' package to stack dataframes (dat_list) using (bind_rows(dat_list)) and group the observations of combined dataframe by year and month using (group_by(year,MONTH)) function, whose output is then piped for summary dataframe using (summarize(n=n())) function of dplyr package. Finally, the output is piped to organize the monthly number of observatons by year using (spread(year,n)) function imported from tidyr package.

Usage

1

Arguments

years

a list or vector containing year specification such as (years=c(2013,2014,2015)) or using (years=list(2013,2014,2015))

Value

This function returns a dataframe, containing number of monthly observations for each year. The monhly observations numbers are organized under columns of years, each column representing a year.

Examples

1
2
3
4
## Not run: 
fars_summarize_years(c(2013,2014,2015))

## End(Not run)

mnazhasan/FarsRpkg documentation built on May 23, 2019, 5:06 a.m.