merge.piar_index {piar}R Documentation

Merge price indexes

Description

Combine two price indexes with common time periods, merging together the index values and percent-change contributions for each time period.

This is useful for building up an index when different elemental aggregates come from different sources of data, or use different index-number formulas.

Usage

## S3 method for class 'piar_index'
merge(x, y, ...)

Arguments

x

A price index, as made by, e.g., elemental_index().

y

A price index, or something that can coerced into one. If x is a period-over-period index then y is coerced into a chainable index; otherwise, y is coerced into a direct index.

...

Not currently used.

Value

A price index that inherits from chainable_piar_index if x is a period-over-period index, or direct_piar_index if x is a fixed-base index. It is not generally possible to merge aggregated indexes, as this would change the aggregation structure, so merging does not return an aggregated index.

See Also

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

Examples

index1 <- as_index(matrix(1:6, 2))

index2 <- index1
levels(index2) <- 3:4

merge(index1, index2)


[Package piar version 0.7.0 Index]