Extract and replace index values over a window of time periods.
Arguments
- x
[piar_index]A price index, as made by, e.g.,elementary_index().- start
[character(1)]The time period to start the window. The default in the first period ofx.- end
[character(1)]The time period to end the window. The default is the last period ofx.- ...
Not currently used.
- value
[numeric > 0 | piar_index]A numeric vector or price index of replacement values.
Value
window() extracts a price index over a window of time periods that
inherits from the same class as x. The replacement method replaces these
with value.
Examples
x <- as_index(matrix(1:9, 3))
window(x, "2")
#> Period-over-period price index for 3 levels over 2 time periods
#> time
#> levels 2 3
#> 1 4 7
#> 2 5 8
#> 3 6 9
window(x, "2") <- 1
x
#> Period-over-period price index for 3 levels over 3 time periods
#> time
#> levels 1 2 3
#> 1 1 1 1
#> 2 2 1 1
#> 3 3 1 1
