Learn R Programming

htsr (version 2.1.6)

h_weightedsum: Weighted sum of time-series

Description

The function only works on the common period of the files without NA values. It operates weighted sums on one or several time-series. It is also possible to add a constant.

Usage

h_weightedsum(files, weights, constant = 0)

Value

The function returns + n hts files with the extracted common period + 1 hts file named as the first file of the list with the prefix w_. The sensor id is automatically set to "weighted".

Arguments

files

List of file names to proceed

weights

List of weights (must have the same length as files)

constant

Constant to add (default = 0)

Author

P. Chevallier - Oct 2017-Oct 2021

Details

For averaging n time-series one can use n weights wit a value of 1/n and constant = 0.