pdata.frame {plm} | R Documentation |
a data.frame
with further attributes useful for panel data
pdata.frame(x,id,time=NULL,name=NULL) ## S3 method for class 'pdata.frame': summary(object,...) ## S3 method for class 'summary.pdata.frame': print(x,...)
x |
a data.frame (a pdata.frame for the print
method), |
object |
a pdata.frame object, |
id |
the individual index, |
time |
the time index, |
name |
the name of the pdata.frame (the name of x if NULL ), |
... |
further arguments. |
The observations are assumed to be sorted by individuals first and by
time observations. id
and time
can be the names of the
indexes contained in the data.frame
if any. time
may be
omitted, in this case a new variable called "time"
is added to
the data.frame
. For balanced panels, the argument id
can
be an integer. In this case, two new variables, "time"
and
"id"
are added to the data.frame
.
pdata.frame
calls pdim
to check for the individual and
time dimensions of the panel and pvar
to check for the
individual and time variation of each variable.
All elements of a pdata.frame
are of class pserie
and have
an attribute data
which is the name of the pdata.frame
.
The print
method is inherited from data.frame
. A
summary
method is provided which add to the
summary.data.frame
method informations about the structure of the panel.
This function returns internally an object of class c("pdata.frame","data.frame")
, which is a
data.frame
with three additional attributes :
indexes |
a list containing the names of the
individual (id ) and time (time ) index variables, |
pdim |
a list containing the dimension of the pdata.frame (see pdim ), |
pvar |
a list of two logical vectors indicating whether each
variable varies across individuals (id.var ) and
accross time periods (time.var ) (see pvar ). |
Yves Croissant
pdim
, pvar
, pread.table
.
library(Ecdat) #There are 595 individuals data(Wages) pdata.frame(Wages,595) # Gasoline contains two variables which are individual and time indexes # The pdata.frame is called gas data(Gasoline) pdata.frame(Gasoline,"country","year",name="gas") summary(gas) # Hedonic is an unbalanced panel, townid is the individual index data(Hedonic) pdata.frame(Hedonic,"townid")