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

Create an X-Times-A-Year Frequency

Description

Use this function to create a frequency for time-series data that occurs x times every year.

Usage

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

Arguments

year

An integer representing the year of the observation.

x

An integer representing the number of observations in each year. It should be a positive integer.

position

An integer representing the position of the current observation. It 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 which is also a list with the following members:

class

Determines the class of this frequency.

year

Determines the year.

x

Determines the value: x.

position

Determines the position.

Examples


xty0 <- f.x.times.a.year(2020, 3, 1)
#      this frequency divides the year 2020 into 3 partitions
#      and refers to the first partition.

xty_value_str <-  as.character(xty0) # this will be '2020:1'.
xty_class_str <- get.class.id(xty0) # this will be 'y3'.

xty_new <- as.frequency("2021:24", "z24")
#     this frequency divides the year 2021 into 24 partitions
#     and refers to the last partition.

# Don't make the following mistakes:

xty_invalid <- try(f.x.times.a.year(2020, 3, 0))
xty_invalid <- try(f.x.times.a.year(2020, 24, 25))
xty_invalid <- try(as.frequency("2021:13", "y12"))
xty_invalid <- try(as.frequency("2021:0", "y1"))
xty_invalid <- try(as.frequency("2021", "y1"))



[Package tdata version 0.3.0 Index]