Learn R Programming

tdata (version 0.3.0)

convert.to.XxYear: Convert Data to Year-Based Frequency

Description

Use this function to convert time-series data (currently implemented: daily) to time-series data with year-based frequency such as monthly, quarterly, yearly, etc.

Usage

convert.to.XxYear(variable, x, aggregateFun)

Value

A variable with year-based frequency.

Arguments

variable

A variable.

x

Determines the number of partitions in each year, for example, use 12 for monthly data.

aggregateFun

Function to aggregate data within each interval.

Details

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

Examples

Run this code
startFreq <- f.daily(c(2023,1,1))
v <- variable(c(1:(365*2)), startFreq)
w <- convert.to.XxYear(v,12,function(x)mean(x))

Run the code above in your browser using DataLab