convert.to.multidaily {tdata}R Documentation

Convert Data to Multi-Day Frequency

Description

Use this function to convert a time-series data (currently implemented: daily) to a time-series data with multi-day frequency.

Usage

convert.to.multidaily(variable, k, aggregateFun, fromEnd = TRUE)

Arguments

variable

A variable.

k

Number of days in multi-day frequency, must be positive.

aggregateFun

Function to aggregate data within each interval.

fromEnd

If the number of observations is not divisible by k, this argument matters. If TRUE, the last observation is the combination of k observations. Otherwise, the last observation may be created from fewer observations.

Details

See the details section of the convert.to.daily function.

Value

A variable with multi-day frequency.

Examples

startFreq <- f.daily(c(2022, 9, 1))
v <- variable(c(1,2,3,4,5,6,7,8), startFreq)
w <- convert.to.multidaily(v, 3, function(x)mean(x, na.rm=TRUE))

[Package tdata version 0.3.0 Index]