pdata.frame {plm}R Documentation

data.frame for panel data

Description

An object of this class is a data.frame with an attribute that describes its time and individual dimensions.

Usage

pdata.frame(x, index = NULL, drop.index = FALSE, row.names = TRUE)
## S3 method for class 'pdata.frame'
x[i, j, drop = TRUE]
## S3 method for class 'pdata.frame'
x[[y]]
## S3 method for class 'pdata.frame'
x$y
## S3 method for class 'pdata.frame'
print(x, ...)
## S3 method for class 'pdata.frame'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

a data.frame for the pdata.frame function and a pdata.frame for the methods,

i

see Extract,

j

see Extract,

y

one of the columns of the data.frame,

index

this argument indicates the individual and time indexes. See details,

drop

see Extract,

drop.index

should the indexes be removed from the data.frame ?

optional

see as.data.frame

row.names

should “fancy” row names be computed ?

...

further arguments

Details

The index argument indicates the dimensions of the panel. It can be:

The index attribute is a data.frame which contains the individual and the time indexes. The "[[" and "$" extract a series from the pdata.frame. The "index" attribute is then added to the series and a class attribute "pseries" is added. The "[" method behaves as for data.frame, except that the extraction is also applied to the index attribute. as.data.frame removes the index from the pdata.frame and adds it to every series.

Value

a pdata.frame object: this is a data.frame with an index attribute which is a data.frame with two variables, the individual and the time indexes.

Author(s)

Yves Croissant

Examples

data("Wages", package = "plm")
Wag <- pdata.frame(Wages, 595)

# Gasoline contains two variables which are individual and time indexes
data("Gasoline", package = "plm")
Gas <- pdata.frame(Gasoline, c("country","year"), drop = TRUE)

# Hedonic is an unbalanced panel, townid is the individual index
data("Hedonic", package="plm")
Hed <- pdata.frame(Hedonic, "townid", row.names = FALSE)

[Package plm version 1.2-10 Index]