Learn R Programming

onlineforecast (version 0.9.3)

make_tday: Make an hour-of-day data.frame with k-step ahead columns.

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 = 3600, units = "hours")

Arguments

time

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

kseq

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

tstep

step time of k in seconds.

units

to return in, e.g. "hours" or "mins"

Value

Returns a data.frame with rownames = times, colnames = k1, k2, k5, ... The content of the data frame is the hour of day, following the setup in "onlineforecast" setup.

Examples

Run this code
# NOT RUN {
# Create a time sequence
tseq <- seq(ct("2019-01-01"), ct("2019-02-01 12:00"), by=1800)

# Make the time of day sequence
make_tday(tseq, 1:10)

# With 0.5 hour steps and in minutes
make_tday(tseq, 1:10, tstep=1800, units="mins")


# }

Run the code above in your browser using DataLab