Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

idx

Index for dfidx


Description

The index of a dfidx is a dat .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

data("TravelMode", package = "AER")
TM1 <- dfidx(TravelMode)
idx(TM1)
inc <- TM1$income
idx(inc)
# get the first index
idx(TM1, 1)
# get the second index
idx(TM1, 2)
idx(inc, 2)

dfidx

Indexed Data Frames

v0.0-4
GPL (>= 2)
Authors
Yves Croissant [aut, cre]
Initial release
2021-02-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.