aggregate_to_monthly: Aggregates the sub-monthly data in a riversCentralAsia data...

View source: R/aggregate_to_monthly.R

aggregate_to_monthlyR Documentation

Aggregates the sub-monthly data in a riversCentralAsia data set to monthly data.

Description

A riversCentralAsia data set can be of type discharge, precipitation, and temperature whereby temerature may be mean, minimum or maximum. The function aggregate_data aggregates all sub-monthly data in the data tibble to monthly data, according to the type-function pair given in the second argument. The user specifies which aggregation function to use for each data type using timetk's summarise_by_time.

Usage

aggregate_to_monthly(dataTable, funcTypeLib)

Arguments

dataTable

A tibble of the format ChirchikRiverBasin. Must contain at least the columns date, data, norm, type and code.

funcTypeLib

is a list of functions with associated data types that will be applied to the data. Currently, the aggregation functions mean and sum are supported. The user specifies the data types which are to be aggregated with either mean or sum.

Value

Returns a tibble of the same format as data with data aggregated to monthly time steps and "mon" in the resolution column. Returns 1 if aggregation fails.

See Also

Other Helper functions: %>%(), cutRaster2Basin(), decadeMaker(), generateSeqDates(), hyear(), monDateSeq(), posixct2rsminerveChar()

Examples

dataTable <- ChirchikRiverBasin
funcTypeLib <- list(mean = c("Q", "T"), sum= "P")
data_mon <- aggregate_to_monthly(dataTable, funcTypeLib)

hydrosolutions/riversCentralAsia documentation built on Feb. 7, 2023, 4:50 p.m.