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:
# \donttest{
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"))
# }
Run the code above in your browser using DataLab