f.x.times.a.day {tdata}R Documentation

Create an X-Times-A-Day Frequency

Description

Use this function to create a frequency for time-series data that occurs x times in a day or a subset of a week.

Usage

f.x.times.a.day(day, x, position)

Arguments

day

A 'Day-based' object of class ldtf, such as Daily or Daily-In-Week.

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 x.

Details

In order to use the as.frequency function for this type of frequency, you need the following information:

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 day.

second

Determines the second.

Examples


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



[Package tdata version 0.3.0 Index]