f.daily: Create a Daily Frequency

View source: R/frequency.R

f.dailyR Documentation

Create a Daily Frequency

Description

Use this function to create a frequency for time-series data that occurs daily.

Usage

f.daily(date)

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.

Details

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

  • Character Format "YYYYMMDD" (similar to Weekly)

  • Class Id "d"

Value

An object of class ldtf, which 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.

Examples


d0 <- f.daily(c(2023, 1, 2)) # This is 2/1/2023. Next observation belongs to 3/1/2023.

d0_value_str <-  as.character(d0) # this will be '20230102'.
d0_class_str <- get.class.id(d0) # this will be 'd'.

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

# Don't use invalid or unsupported dates:

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



tdata documentation built on Nov. 7, 2023, 5:07 p.m.