f.x.times.a.day | R Documentation |
X-Times-A-Day
FrequencyUse this function to create a frequency for time-series data that occurs x
times in a day or a subset of a week.
f.x.times.a.day(day, x, position)
day |
A 'Day-based' object of class |
x |
The number of observations in each day. |
position |
The position of the current observation, which should be a positive integer and cannot be larger than |
In order to use the as.frequency
function for this type of frequency,
you need the following information:
Character Format: "#"
(where '#' represents the value of position
)
Class Id: "da#|..."
(where '#' represents the value of x
and '...' 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 |
second |
Determines the |
xd0 <- f.x.times.a.day(f.daily(c(2023,5,16)),13, 12)
xd0_value_str <- as.character(xd0) # this will be '20230516:12'.
xd0_class_str <- get.class.id(xd0)
# this will be 'da13|d'. The second part (i.e., 'd')
# shows that this frequency is defined in a 'Daily' frequency.
xd_new <- as.frequency("20231101:3", "da3|i:wed-sat")
# Don't make the following mistakes:
xd_invalid <- try(as.frequency("20231101:3", "da|i:wed-sat"))
# invalid format in day-based frequency
xd_invalid <- try(f.x.times.a.day(f.daily(c(2023,5,16)),4,0)) # invalid position
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.