f.x.times.z.years {tdata}R Documentation

Create an X-Times-Z-Years Frequency

Description

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

Usage

f.x.times.z.years(year, x, z, position)

Arguments

year

An integer representing the year of the observation.

x

An integer representing the number of partitions in each z years. It should be a positive integer.

z

An integer representing the number of years. 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

The class of this frequency.

year

The year.

z

The value: z.

x

The value: x.

position

The position.

Examples


xtzy0 <- f.x.times.z.years(2020, 3, 2, 3)
# This frequency divides the year 2020 into 3 partitions and
# refers to the last partition. The next observation
# belongs to 2022 (not the next year).

xtzy_value_str <- as.character(xtzy0) # This will be '2020:3'.
xtzy_class_str <- get.class.id(xtzy0) # This will be 'x3z2'.

xtzy_new <- as.frequency("2021:3", "x3z4")
# This frequency divides the year 2021 into 3 partitions
# and refers to the last partition. The next observation occurs after 4 years.

# Don't make the following mistakes:

xtzy_invalid <- try(f.x.times.z.years(2020, 3, 5, 0))
xtzy_invalid <- try(f.x.times.z.years(2020, 3, 0, 1))
xtzy_invalid <- try(as.frequency("2021:25", "x24y2"))



[Package tdata version 0.3.0 Index]