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 |
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:
-
Character Format: The first day of the interval in
"YYYYMMDD"
format. -
Class Id:
"d#"
(where # is the value ofk
; e.g., d3 means every 3 days)
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 |
month |
Determines the |
day |
Determines the |
k |
Determines the value: |
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