Learn R Programming

plm (version 0.1-2)

within: The within transformation

Description

Computes the within transformation

Usage

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

Arguments

x
a numeric vector or a matrix,
cond
a vector containing the conditional variable,
effect
the effect for the within transformation (one of individual, time and twoways),
...
further arguments.

Value

  • a vector of the same length as x containing the within transformation. NA values are inserted at the correct positions

See Also

between and papply

Examples

Run this code
library(Ecdat)
data(Grunfeld)
pdata.frame(Grunfeld,"firm","year")
wi <- within(Grunfeld$inv)
w2 <- within(Grunfeld$inv,effect="twoways")
X <- model.matrix(~value+capital-1,Grunfeld)
Xt <- within(X,Grunfeld$firm)

Run the code above in your browser using DataLab