idx: Index for dfidx

View source: R/miscellaneous.R

idxR Documentation

Index for dfidx

Description

The index of a dfidx is a data.frame containing the different series which define the two indexes (with possibly a nesting structure). It is stored as a "sticky" data.frame column of the data.frame and is also inherited by series (of class 'xseries') which are extracted from a dfidx.

Usage

idx(x, n = NULL, m = NULL)

## S3 method for class 'dfidx'
idx(x, n = NULL, m = NULL)

## S3 method for class 'idx'
idx(x, n = NULL, m = NULL)

## S3 method for class 'xseries'
idx(x, n = NULL, m = NULL)

## S3 method for class 'idx'
format(x, size = 4, ...)

Arguments

x

a dfidx or a xseries

n, m

n is the index to be extracted (1 or 2), m equal to one to get the index, greater than one to get a nesting variable.

size

the number of characters of the indexes for the format method

...

further arguments (for now unused)

Details

idx is defined as a generic with a dfidx and a xseries method.

Value

a data.frame containing the indexes or a series if a specific index is selected

Author(s)

Yves Croissant

Examples

mn <- dfidx(munnell, idx = c(region = "state", president = "year"))
idx(mn)
gsp <- mn$gsp
idx(gsp)
# get the first index
idx(mn, 1)
# get the nesting variable of the first index
idx(mn, 1, 2)

dfidx documentation built on Sept. 11, 2024, 7:55 p.m.

Related to idx in dfidx...