f.hourly | R Documentation |
Use this function to create a frequency for time-series data that occurs hourly in a day or a subset of a week.
f.hourly(day, hour)
day |
A 'Day-based' object of class |
hour |
The index of the hour in the day, which should be between 1 and 24. |
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 of hour
)
Class Id: ho|...
(where '...' represents the 'class id' of day
)
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 |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.