vincentarelbundock / modelsummary

Beautiful and customizable model summaries in R.
http://modelsummary.com
Other
913 stars 77 forks source link

Modelsummary fails on fixest models with clustered SEs and dot aligned columns #826

Open svraka opened 1 week ago

svraka commented 1 week ago

See this minimal example:

---
title: Error with dot aligned tables
output: pdf_document
---

```{r}
library(fixest)
devtools::load_all()

m <- feols(mpg ~ wt | cyl, data = mtcars)

modelsummary(m, align = "ld")

Modelsummary adds a GoF with the standard error type "by: cyl", which is not a valid value for siunix:

Rscript -e "rmarkdown::render('.scratch/d1.Rmd', quiet = TRUE)" ! Package siunitx Error: Invalid number ':'.


We can declare it as a non-numeric row with a manual workaround but it would be nice if modelsummary did it automatically:

````markdown
---
title: Fixed dot aligned tables
output: pdf_document
---

```{r}
library(fixest)
devtools::load_all()

m <- feols(mpg ~ wt | cyl, data = mtcars)

modelsummary(m, align = "ld") |>
  tinytable::style_tt(tabularray_inner = "row{12}={guard}")


Note that the X for the fixed effect line caused no issues.
vincentarelbundock commented 1 week ago

I agree that this is not a great user experience, and the fact that the table doesn't compile at all makes this feel like a more serious issue than https://github.com/vincentarelbundock/modelsummary/issues/827

Thanks for posting. I'll think about it.