Replacing the Index of Objects
frequency.RdGeneric function for replacing the frequency of an object.
Usage
frequency(x) <- valueDetails
frequency<- is a generic function for replacing (or assigning)
the frequency of an object. Currently, there is a "zooreg" and
a "zoo" method. In both cases, the value is assigned
to the "frequency" of the object if it complies with the
index(x).
Examples
z <- zooreg(1:5)
z
#> 1 2 3 4 5
#> 1 2 3 4 5
as.ts(z)
#> Time Series:
#> Start = 1
#> End = 5
#> Frequency = 1
#> [1] 1 2 3 4 5
frequency(z) <- 3
z
#> 1(1) 2(1) 3(1) 4(1) 5(1)
#> 1 2 3 4 5
as.ts(z)
#> Time Series:
#> Start = c(1, 1)
#> End = c(5, 1)
#> Frequency = 3
#> [1] 1 NA NA 2 NA NA 3 NA NA 4 NA NA 5