fixest offers a tool, the function etable, to view estimation tables in R or export them to Latex.

The main advantage of this function is its simplicity: it is completely integrated with other fixest functions, making it exceedingly easy to export multiple estimation results with, say, different types of standard-errors. On the other hand, its main limitations are that i) only fixest objects can be exported, and ii) only Latex is supported.

It also offers a fair deal of customization, and since you can seamlessly change its default values, you can completely transform the style of your tables without modifying a single line of code.

Note that there exists excellent alternatives to export tables, like for instance modelsummary or texreg; but they are, necessarily, less integrated with fixest objects, often necessiting more lines of code to export the same results.

This document does not describe etable’s arguments in details (the help page provides many examples). Rather, it illustrates how to change the style of the table, once and for all.

This document applies to fixest version 0.6.0 or higher.

## First example

Using data from the airquality data base, let’s estimate 5 models:

library(fixest)
data(airquality)

setFixest_notes(FALSE) # To avoid messages when NAs are removed

est_noFE = feols(Ozone ~ Solar.R + Wind + Temp, airquality)
est_1FE  = feols(Ozone ~ Solar.R + Wind + Temp | Day, airquality)
est_2FE  = feols(Ozone ~ Solar.R + Wind + Temp | Day + Month , airquality)
est_poly = feols(Ozone ~ Solar.R + Wind + poly(Temp, 3) | Day + Month, airquality)
est_slopes = feols(Ozone ~ Solar.R + Wind | Day + Month[Temp], airquality)

To export the results to Latex, we use etable. We first set the dictionnary renaming the variables, then we export the results with clustered standard-errors at the Day level:

# Dictionary => set only once per session
setFixest_dict(c(Ozone = "Ozone (ppb)", Solar.R = "Solar Radiation (Langleys)",
Wind = "Wind Speed (mph)", Temp = "Temperature"))

etable(est_noFE, est_1FE, est_2FE, est_poly, est_slopes, cluster = "Day", tex = TRUE,
group = list("Temperature (cubic)" = "poly"), notes = "Estimation of 5 models.")

The previous code produces the following table:

What can we notice? First, all variables are appropriately labeled. Second, all standard-errors are clustered by Day, and this is mentioned in the table footer. This is achieved with the argument cluster. Third, there’s a fixed-effects section telling which model has which fixed-effect. Fourth, the polynomial of the Temperature is not shown, instead there’s a line telling which model includes a cubic polynomial. This is achieved with the argument group.

The style of the table is rather sober, but no worries: most of it can be customized.

## Setting the style, once and for all

The argument style defines how the table looks. It allows an in-depth customization of the table. The table is split into several components, each allowing some customization. The components of a table and some of its associated keywords are described by the following figure:

The argument style must be a list, the names of which correspond to the different components. Each element of this list must be a single character string of the form "keyword1:value1; keyword2:value; etc". The missing components fall back to their default values. The components, with the keywords they accept and their defaults are:

• depvar: title. Default "title:Dependent Variable(s):".
• model: title, format. Default "title:Model:; format:(1)". In format, you can use the special values 1, i, I, a or A; the corresponding values will be increased across the model columns.
• var: title. Default "title:\\emph{Variables}".
• fixef: title, prefix, suffix, where. Default "title:\\emph{Fixed-effects}; where:var". Valid values of where are “var” or “stats”.
• slopes: title, format. Default "title:\\emph{Varying Slopes}; format:__var__ (__slope__)". In format, the special values __var__ and __slope__ are replaced with the corresponding labels of the variables and of the slope.
• stats: title. Default "title:\\emph{Fit statistics}".
• notes: title. Default "title:\\emph{\\medskip Notes:} ".
• lines: top, foot, bottom, sep. Default "top:\\tabularnewline\\toprule\\toprule;bottom:;foot:\\bottomrule\\bottomrule;sep:\\midrule".

Missing keywords are considered to be equal to the empty string.

Now the style argument is illustrated along with the modification of default values.

#### Changing the default values

To permanently change the default values for function etable, just use the function setFixest_etable:

new_style = list(lines = "top:\\toprule; bottom:\\bottomrule",
var = "title:\\midrule", # cleans the title but keeps line
depvar = "", # cleans the title
model = "format:$Model_{I}$",  # cleans the titles + changes model format
fixef = "title: ; suffix: fixed effects; where:stats",
# fixef: cleans the titles + adds a suffix + places after the stats
slopes = "format:__var__ $\\times$ __slope__",
stats = "title: ") # cleans the title but adds an empty line

setFixest_etable(fitstat = ~r2, signifCode = NA, yesNo = "$\\checkmark$",
tablefoot = FALSE, style = new_style)

And now, using the exact same line of code as in the first example, we obtain a table with a different style:

etable(est_noFE, est_1FE, est_2FE, est_poly, est_slopes, cluster = "Day", tex = TRUE,
group = list("Temperature (cubic)" = "poly"), notes = "Estimation of 5 models.")