Learn R Programming

tdata (version 0.3.0)

convert.to.multidaily: 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)

Value

A variable with multi-day frequency.

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.

Examples

Run this code
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))

Run the code above in your browser using DataLab