Search code examples
rfixest

How to rename complicated variable name in fixest etable


I'm wondering how to change a complex variable name with dict in etable in fixest package.

For example, I have a regression Y ~ x1 + x2:abs(x3):x4 and I'd like to change the name of x2:abs(x3):x4.

I have tried

etable(...,
dict = c(`x2:abs(x3):x4` = 'myvar')
)
etable(...,
dict = c("x2:abs(x3):x4" = 'myvar')
)
etable(...,
dict = c("x2*abs(x3)*x4" = 'myvar')
)

But no success. Is there a easy fix for this?


Solution

  • It works. It's likely a version problem:

    library(fixest)
    est = feols(mpg ~ cyl:abs(disp):hp, mtcars)
    etable(est, dict=c("cyl:abs(disp):hp" = "New coef"))
    #>                                  est
    #> Dependent Var.:                  mpg
    #>                                     
    #> (Intercept)        25.05*** (0.9560)
    #> New coef        -1.65e-5*** (2.3e-6)
    #> _______________ ____________________
    #> S.E. type                   Standard
    #> Observations                      32
    #> R2                           0.63073
    #> Adj. R2                      0.61842
    

    Otherwise, please provide a minimal reproducible example.