Replacing the Index of Objects

Description

Generic function for replacing the frequency of an object.

Usage

frequency(x) <- value

Arguments

x an object.
value a frequency.

Details

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).

See Also

zooreg, index

Examples

library("zoo")

z <- zooreg(1:5)
z
1 2 3 4 5 
1 2 3 4 5 
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 
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