get.aggregated.value: Get Aggregated Value

Description Usage Arguments Details Value See Also Examples

View source: R/get.aggregated.value.R

Description

Function to get the aggregated value for a single aggregation period

Usage

1
2
3
get.aggregated.value(date, data, agg.length, agg.fun = "sum",
  agg.na.thres = 10, agg.interpolation = c("none", "linear", "mean",
  "zeros"), period.warn = TRUE)

Arguments

date

date for which the aggregated value is determined

data

an xts object containing daily data

agg.length

length of the aggregation period in days

agg.fun

function on x to apply to the aggregation data, default is 'sum'

agg.na.thres

threshold for the percentage of na values allowed in the aggregation period data, default = 10

agg.interpolation

interpolation type for missing values in individual aggregation period data before applying agg.fun: 'none' (default, NA's are removed), 'linear', 'mean', or 'zeros'

period.warn

if TRUE, a warning is when the requested aggregation period contains dates not included in data

Details

This function determines the dates in an aggregation period for standardized index calculation, extracts the corresponding data and applies an aggregation function to the data (default is 'sum', but any function on x can be passed).

Value

A numeric value giving the aggregated value for the aggregation period

See Also

standardized.index, get.reference.values

Examples

1
2
3
4
data(Ukkel_RR)
date <- as.Date('2018-07-01')
# get the aggregated value values for the 30 day-period preceding date
get.aggregated.value(date = date, data = Ukkel_RR, agg.length=30)

WillemMaetens/standaRdized documentation built on May 21, 2019, 10:29 a.m.