You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/appearance.Rmd
+23-21Lines changed: 23 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -190,6 +190,28 @@ tab %>%
190
190
set_text_color(row = 4, col = 1:ncol(.), value = 'red')
191
191
```
192
192
193
+
194
+
# `DT`
195
+
196
+
[The `DT` package](https://rstudio.github.io/DT/) is an interface to [the JavasScript DataTables library.](https://datatables.net/) We can create a `DT` table by using the `output` argument, and pass arguments to `modelsummary()` which will be passed forward to the `DT::datatable` to customize the output of the table. For example, let's use the `fixest` package to estimate multiple linear regression models, and the `DT` package to create a table with a "frozen" first column:
If you want to apply the same post-processing functions to your tables, you can use `modelsummary`'s theming functionality. To do so, we first create a function to post-process a table. This function must accept a table as its first argument, and include the ellipsis (`...`). Optionally, the theming function can also accept an `hrule` argument which is a vector of row positions where we insert horizontal rule, and an `output_format` which allows output format-specific customization. For inspiration, you may want to consult the default `modelsummary` themes in the [`themes.R` file of the Github repository.](https://github.com/vincentarelbundock/modelsummary)
@@ -232,7 +254,7 @@ mod <- lm(mpg ~ hp + drat, mtcars)
232
254
modelsummary(mod, output = "dataframe")
233
255
```
234
256
235
-
Imagine we want to create a table using the `DT` package, a table-drawing backend which is not currently supported by `modelsummary`. To do this, we can create a theming function:
257
+
`modelsummary` supports the `DT` table-making package out of the box. But for the sake of illustration, imagine we want to create a table using the `DT` package with specific customization and options, in a repeatable fashion. To do this, we can create a theming function:
[The `DT` package](https://rstudio.github.io/DT/) is an interface to [the JavasScript DataTables library.](https://datatables.net/) We can create a `DT` table by using the `output` argument, and pass arguments to `modelsummary()` which will be passed forward to the `DT::datatable` to customize the output of the table. For example, let's use the `fixest` package to estimate multiple linear regression models, and the `DT` package to create a table with a "frozen" first column:
0 commit comments