papply {plm} | R Documentation |
Apply an operation to a vector or a matrix for panel data.
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, ...)
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. |
a vector (or a matrix) of the same dimension as the first argument.
Yves Croissant
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)