f.hourly {tdata} | R Documentation |
Create an 'Hourly' Frequency
Description
Use this function to create a frequency for time-series data that occurs hourly in a day or a subset of a week.
Usage
f.hourly(day, hour)
Arguments
day |
A 'Day-based' object of class |
hour |
The index of the hour in the day, which should be between 1 and 24. |
Details
In order to use the as.frequency
function for this type of frequency,
you need the following information:
-
Character Format:
"YYYYMMDD:#"
(where # represents the value ofhour
) -
Class Id:
ho|...
(where '...' represents the 'class id' ofday
)
Value
An object of class ldtf
. It is also a list with the following members:
class |
Determines the class of this frequency. |
day |
Determines the |
hour |
Determines the |
Examples
ho0 <- f.hourly(f.daily(c(2023,5,16)),4)
ho0_value_str <- as.character(ho0) # this will be '20230516:4'.
ho0_class_str <- get.class.id(ho0)
# this will be 'ho|d'. The second part (i.e., 'd')
# shows that this frequency is defined in a 'Daily' frequency.
ho_new <- as.frequency("20231101:3", "ho|i:wed-sat")
# Don't make the following mistakes:
ho_invalid <- try(as.frequency("20231101:3", "ho|j:wed-sat"))
# invalid format in day-based frequency
ho_invalid <- try(f.hourly(f.daily(c(2023,5,16)),25)) # invalid hour
[Package tdata version 0.3.0 Index]