split.piar_index {piar} | R Documentation |
Split an index into groups
Description
Split an index into groups of indexes according to a factor, along either the levels or time periods of the index.
Usage
## S3 method for class 'piar_index'
split(x, f, drop = FALSE, ..., margin = c("levels", "time"))
## S3 replacement method for class 'piar_index'
split(x, f, drop = FALSE, ..., margin = c("levels", "time")) <- value
Arguments
x |
A price index, as made by, e.g., |
f |
A factor or list of factors to group elements of |
drop |
Should levels that do not occur in |
... |
Further arguments passed to |
margin |
Either 'levels' to split over the levels of |
value |
A list of values compatible with the splitting of |
Value
split()
returns a list of index objects for each level in f
. The
replacement method replaces these values with the corresponding element of
value
.
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()
,
merge.piar_index()
,
stack.piar_index()
,
time.piar_index()
,
vcov.aggregate_piar_index()
Examples
index <- as_index(matrix(1:6, 2))
split(index, 1:2)
split(index, c(1, 1, 2), margin = "time")