plm (version 1.6-5)

pvar: Check for Cross-Sectional and Time Variation

Description

This function checks for each variable of a panel if it varies cross-sectionally and over time.

Usage

pvar(x, ...) "pvar"(x, index = NULL, ...) "pvar"(x, ...) "pvar"(x, index = NULL, ...) "print"(x, ...)

Arguments

x
a (p)data.frame or a matrix,
index
...
further arguments.

Value

An object of class pvar containing the following elements:

Details

For (p)data.frame and matrix interface: All-NA columns are removed prior to calculation of variation due to coercing to pdata.frame first.

See Also

pdim to check the dimensions of a 'pdata.frame' (and other objects),

Examples

Run this code

# Gasoline contains two variables which are individual and time indexes
# and are the first two variables
data("Gasoline", package = "plm")
pvar(Gasoline)

# Hedonic is an unbalanced panel, townid is the individual index;
# the drop.index argument is passed to pdata.frame
data("Hedonic", package = "plm")
pvar(Hedonic, "townid", drop.index = TRUE)

# same using pdata.frame
Hed <- pdata.frame(Hedonic, "townid", drop.index = TRUE)
pvar(Hed)

# Gasoline with pvar's matrix interface
Gasoline_mat <- as.matrix(Gasoline)
pvar(Gasoline_mat)
pvar(Gasoline_mat, index=c("country", "year"))

Run the code above in your browser using DataLab