Learn R Programming

piar (version 0.10.1)

window.piar_index: Window a price index

Description

Extract and replace index values over a window of time periods.

Usage

# S3 method for piar_index
window(x, start = NULL, end = NULL, ...)

# S3 method for piar_index window(x, start = NULL, end = NULL, ...) <- value

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.

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 of x.

end

[character(1)] The time period to end the window. The default is the last period of x.

...

Not currently used.

value

[numeric > 0 | piar_index] A numeric vector or price index of replacement values.

See Also

Other index methods: [.piar_index(), aggregate.piar_index, as.data.frame.piar_index(), as.ts.piar_index(), chain(), contrib(), head.piar_index(), is.na.piar_index(), levels.piar_index(), mean.piar_index, merge.piar_index(), split.piar_index(), stack.piar_index(), time.piar_index()

Examples

Run this code
x <- as_index(matrix(1:9, 3))

window(x, "2")

window(x, "2") <- 1
x

Run the code above in your browser using DataLab