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:
# \donttest{
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
# }
Run the code above in your browser using DataLab