Learn R Programming

dsa (version 1.0.12)

to_weekly: Change a daily to a weekly differenced time series

Description

This function computes the weekly aggregates or differences (by default Friday to Friday) for any daily time series in the xts format.

Usage

to_weekly(x, incl_forecast = T, forecast_length = 365, diff = T, dayofweek = 5)

Arguments

x

input series

incl_forecast

whether the series contains a forecast that shall be omitted

forecast_length

length of forecast

diff

should series be differenced

dayofweek

which day of the week (friday=5)

Examples

Run this code
# NOT RUN {
to_weekly(xts::xts(rnorm(365, 10,1), seq.Date(as.Date("2010-01-01"), length.out=365, by="days")))
# }

Run the code above in your browser using DataLab