f.multi.daily {tdata}R Documentation

Create a Multi-Day Frequency

Description

Use this function to create a frequency for time-series data that occurs every k days. The first day of the interval is used as the reference.

Usage

f.multi.daily(date, k)

Arguments

date

The date, which can be a list with year, month, and day elements. It can also be an integer array with 3 elements for year, month, and day respectively, or an object that can be used as an argument for the base::as.Date function.

k

The number of days in the interval.

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.

year

Determines the year.

month

Determines the month.

day

Determines the day.

k

Determines the value: k.

Examples


md0 <- f.multi.daily(c(2023, 1, 2), 4) # This is 2/1/2023. Next observation belongs to 6/1/2023.

md0_value_str <-  as.character(md0) # this will be '20230102'.
md0_class_str <- get.class.id(md0) # this will be 'd4'.

md_new <- as.frequency("20230109", "d") # This is 9/1/2023.

# Don't use invalid or unsupported dates:

md_invalid <- try(as.frequency("1399109", "d3")) # this is a too old date and unsupported
md_invalid <- try(as.frequency("20230132", "d4")) # invalid day in month
md_invalid <- try(as.frequency("20231331", "d5")) # invalid month



[Package tdata version 0.3.0 Index]