papply {plm}R Documentation

Conditional operation for panel data

Description

Apply an operation to a vector or a matrix for panel data.

Usage

papply(x, ...)
## S3 method for class 'pserie':
papply(x,func,effect="individual", ...)
## S3 method for class 'matrix':
papply(x,func,cond, ...)
## Default S3 method:
papply(x,func,cond, ...)

Arguments

x a numeric vector or matrix,
func the function to apply to x,
cond a vector containing the conditional variable,
effect the effect for the papply transformation (one of individual or time),
... further arguments.

Value

a vector (or a matrix) of the same dimension as the first argument.

Author(s)

Yves Croissant

Examples

library(Ecdat)
data(Grunfeld)
pdata.frame(Grunfeld,"firm","year")
papply(Grunfeld$inv,mean)
X <- model.matrix(~value+capital-1,Grunfeld)
papply(X,mean,Grunfeld$firm)

[Package plm version 0.2-2 Index]