make_tday: Make an hour-of-day forecast matrix

View source: R/make_tday.R

make_tdayR Documentation

Make an hour-of-day forecast matrix

Description

This function creates a data.frame with k-steps-ahead values of hour of day, such that it can be added to a data.list and used inputs to a forecast model.

Usage

make_tday(time, kseq, tstep = NA)

Arguments

time

vector of times of class "POSIXct" "POSIXt".

kseq

vector of integers, representing the desired "k-steps ahead".

tstep

step time of k in seconds.

Value

Returns a forecast matrix (data.frame) with rownames = times, colnames = k1, k2, k3, ... The content of the data frame is the hour of day.

See Also

make_periodic

Examples

# Create a time sequence of 30 min sample period
tseq <- seq(ct("2019-01-01"), ct("2019-02-01 12:00"), by=1800)

# Make the time of day sequence (assuming time between k steps is same as for tseq)
make_tday(tseq, 1:10)

# With 0.5 hour steps, kstep in hours
make_tday(tseq, 1:10, tstep=3600)



onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.