Learn R Programming

tdata (version 0.3.0)

convert.to.weekly: Convert Data to Weekly Frequency

Description

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

Usage

convert.to.weekly(variable, weekStart, aggregateFun)

Value

A variable with weekly frequency.

Arguments

variable

A variable.

weekStart

Determines the start day of the week, can be sun, mon, tue, wed, thu, fri, or sat.

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(2022, 9, 1))
v <- variable(c(1,2,3,4,5,6,7,8), startFreq)
w <- convert.to.weekly(v, "mon", function(x)mean(x, na.rm=TRUE))

Run the code above in your browser using DataLab