lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
361 stars 59 forks source link

Escape latex in fit statistics aliases in `esttex()`, fixes #505 #508

Closed MaelAstruc closed 3 weeks ago

MaelAstruc commented 3 weeks ago

Fix the issue #505 by escaping special characters in the fit statistics aliases when exporting the results to latex with esttex() or esttable().

The previous tests still pass.

Here is a simple test that did not pass before:

N <- 1000

df <- data.frame(
    z = runif(N),
    e1 = rnorm(N),
    e2 = rnorm(N)
)

df$x_ <- 1 + 2 * df$z + df$e1
df$y <- 3 + 4 * df$x + df$e2

temp_dir <- tempdir()
temp_file <- paste0(temp_dir, "/test_tex_escape.png")

results <- fixest::feols(y ~ 1 | x_ ~ z, data = df)

fixest::esttex(results, fitstat = "ivf", export = temp_file)

file.remove(temp_file)
lrberge commented 3 weeks ago

Thanks.