Skip to content

Instantly share code, notes, and snippets.

@grantmcdermott
Created December 4, 2024 18:42
Show Gist options
  • Save grantmcdermott/9de5121e0cfb6b17043ed1c18d43e3c0 to your computer and use it in GitHub Desktop.
Save grantmcdermott/9de5121e0cfb6b17043ed1c18d43e3c0 to your computer and use it in GitHub Desktop.
fixest -> modelsummary -> typst
# Context: https://bsky.app/profile/thetahat.bsky.social/post/3lchztjxufc2t
library(fixest)
library(modelsummary)
library(tinytable)
mods = feols(
rating ~ complaints + privileges + learning + csw0(raises + critical),
data = attitude
)
dict = c("rating" = "Overall Rating",
"complaints" = "Handling of Complaints",
"privileges" = "No Special Priviledges",
"learning" = "Opportunity to Learn",
"raises" = "Performance-Based Raises",
"critical" = "Too Critical")
## regression table and write to .typ file
modelsummary(
setNames(mods, c("(1)", "(2)")), # optional renaming
coef_map = dict,
stars = TRUE,
gof_omit = "IC|RMSE"
) |>
# optional formatting
format_tt(escape = TRUE) |> ## if stars = TRUE above
group_tt(j = list("Dep. variable: Overall Rating" = 2:3)) |>
# save as .typ file
save_tt("results.typ", overwrite = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment