Create and present analysis tables consistently. Use when writing R analysis outputs with coefficients or summary statistics; prefer LaTeX table artifacts on disk and present key numeric results as terminal tables in responses.
.csv) and a publication table to disk (.tex).fixest::etable, knitr::kable, or gt).p_out(cfg, ...)), never hardcoded.estimate, std_error, p_value, n_obs).fixest::etable(..., tex = TRUE) for regression tables.summary(model)$coeftable.knitr::kable(..., format = "latex", booktabs = TRUE) or gt::as_latex() for non-regression tables.# Regression table (LaTeX)
tex_lines <- capture.output(fixest::etable(list(m1, m2), se.below = TRUE, digits = 3, tex = TRUE))
writeLines(tex_lines, con = p_out(cfg, "tables", "model_main.tex"))
# Coefficient CSV
ct <- data.table::as.data.table(summary(m1)$coeftable, keep.rownames = "term")
data.table::setnames(ct, c("Estimate", "Std. Error", "Pr(>|t|)"), c("estimate", "std_error", "p_value"))
data.table::fwrite(ct, p_out(cfg, "tables", "model_main_coefficients.csv"))