Skip to contents

Transforms a fixest_panel object into a regular data.frame.

Usage

unpanel(x)

Arguments

x

A fixest_panel object (obtained from function panel).

Value

Returns a data set of the exact same dimension. Only the attribute 'panel_info' is erased.

See also

Alternatively, the function panel changes a data.frame into a panel from which the functions l and f (creating leads and lags) can be called. Otherwise you can set the panel 'live' during the estimation using the argument panel.id (see for example in the function feols).

Author

Laurent Berge

Examples


data(base_did)

# Setting a data set as a panel
pdat = panel(base_did, ~id+period)

# ... allows you to use leads and lags in estimations
feols(y~l(x1, 0:1), pdat)
#> NOTE: 108 observations removed because of NA values (RHS: 108).
#> OLS estimation, Dep. Var.: y
#> Observations: 972 
#> Standard-errors: Clustered (id) 
#>             Estimate Std. Error   t value  Pr(>|t|)    
#> (Intercept) 2.234786   0.203176 10.999281 < 2.2e-16 ***
#> x1          0.994800   0.048671 20.439162 < 2.2e-16 ***
#> l(x1, 1)    0.040962   0.055826  0.733756    0.4647    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> RMSE: 4.90919   Adj. R2: 0.264064

# Now unpanel => returns the initial data set
class(pdat) ; dim(pdat)
#> [1] "fixest_panel" "data.frame"  
#> [1] 1080    6
new_base = unpanel(pdat)
class(new_base) ; dim(new_base)
#> [1] "data.frame"
#> [1] 1080    6