lrberge / fixest

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

[feature request] make output compatible with gt #461

Closed halidaee closed 5 months ago

halidaee commented 6 months ago

Posit's gt package (https://gt.rstudio.com) is getting a lot of development, and posit packages are historically well supported. It would be great if there would be an option in fixest to output results in a format compatible with gt.

kylebutts commented 6 months ago

@halidaee Have you tried this package? https://www.danieldsjoberg.com/gtsummary/articles/tbl_regression.html

halidaee commented 6 months ago

@kylebutts I had not! It's a very nice option. However, (and this could be my own limited testing) it is a bit opinionated vs plain gt. As a result, when trying to create tables with multiple regression results side-by-side, it is a lot more formatting work to transform results than if fixest were able to directly output to gt.

lrberge commented 6 months ago

Hi, wouldn't modelsummary work for this purpose? Full integration (ie gt tables equivalent to latex tables) is a bit of work and I won't be able to develop it in the near future. Side note: I very likely will add typst integration at some point.

halidaee commented 5 months ago

Good to know! will try it out and report back when I get a chance. Thanks!

On Jan 4, 2024 at 7:08:28 AM, Laurent Bergé @.***> wrote:

Hi, wouldn't modelsummary https://modelsummary.com/man/modelsummary.html work for this purpose? Full integration (ie gt tables equivalent to latex tables) is a bit of work and I won't be able to develop it in the near future. Side note: I very likely will add typst https://typst.app/ integration at some point.

— Reply to this email directly, view it on GitHub https://github.com/lrberge/fixest/issues/461#issuecomment-1876992575, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCRYSTANZWKL2U3YV43M53YM2LTZAVCNFSM6AAAAABASFIPVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZWHE4TENJXGU . You are receiving this because you were mentioned.Message ID: @.***>

grantmcdermott commented 5 months ago

Two notes on this:

  1. You can certainly use modelsummary+gt to parse and display fixest regression tables. So I think we can close this issue.
  2. But... Vincent recently released the very cool tinytable package, which he intends to replace gt as the default backend to modelsummary. You can read about his motivation and the tradeoffs here, but I personally them very compelling. More to the point, the modelsummary+tinytable approach works equally well on fixest objects (and it supports typst!)
library(fixest)
## NOTE: dev versions for both modelsummary and tinytable
library(modelsummary)
library(tinytable)
options(tinytable_print_output = "html")

mods = feols(c(mpg, hp) ~ wt, mtcars, fsplit = ~am)

msummary(mods) 

msummary(mods) |>
    style_tt(
        i = 0,
        color = "white",
        background = "hotpink"
    )