pdata.frame {plm} | R Documentation |
An object of this class is a data.frame with an attribute that describes its time and individual dimensions.
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, ...)
x |
a |
i |
see |
j |
see |
y |
one of the columns of the |
index |
this argument indicates the individual and time indexes. See details, |
drop |
see |
drop.index |
should the indexes be removed from the data.frame ? |
optional |
see |
row.names |
should “fancy” row names be computed ? |
... |
further arguments |
The index
argument indicates the dimensions of the panel. It can be:
a character string which is the name of the individual index variable, in this case a new variable called “time” which contains the time index is added,
an integer, the number of individuals in case of balanced panel, in this case two new variables “time” and “id” which contain the individual and the time indexes are added,
a vector of two character strings which contains the names of the individual and of the time indexes.
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.
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.
Yves Croissant
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)