Skip to content

Commit c01cc28

Browse files
committed
fix
1 parent dfd7461 commit c01cc28

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vignettes/model_parameters_print.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ print(mp, column_width = c(SE = 8, `95% CI` = 12, p = 7))
192192

193193
## Group parameters
194194

195-
The `groups` argument can be used to group parameters in the table. `groups` must be a named list, where the names of the list elements equal the header of each group, while the values of the list elements equal the parameter names, or the position of the parameters in the table (data frame).
195+
The `groups` argument can be used to group parameters in the table. `groups` must be a named list, where the names of the list elements equal the header of each group, while the values of the list elements equal the parameter names, or the position of the parameters in the table (data frame). Usually, indexing by position is easier, since the parameter names can be modified during formatting the output.
196196

197197
In the following example, we see the names of the parameters in the `Parameter` column, while the rownumbers indicate their position.
198198

@@ -209,17 +209,17 @@ mp <- model_parameters(model, drop = "^\\(Intercept")
209209
as.data.frame(mp)
210210
```
211211

212-
Now we create a group named `"Engine"`, which encompasses the parameters `"cyl6"`, `"cyl8"`, `"vs"` and `"hp"`. The `"Interactions"` group includes `"gear4:vs"` and `"gear5:vs"`. The group `"controls"` has the parameters from rows 2, 3 and 7.
212+
Now we create a group named `"Engine"`, which encompasses the parameters `"cyl6"`, `"cyl8"`, `"vs"` and `"hp"` (rows 5, 6, 4 and 1). The `"Interactions"` group includes `"gear4:vs"` and `"gear5:vs"` (rows 8 and 9). The group `"controls"` has the parameters from rows 2, 3 and 7.
213213

214214
Note that the parameters in the table summary are re-ordered according to the order specified in `groups`.
215215

216216
```{r}
217217
# group parameters, either by parameter name or position
218218
print(mp, groups = list(
219-
Engine = c("cyl6", "cyl8", "vs", "hp"),
220-
Interactions = c("gear4:vs", "gear5:vs"),
219+
Engine = c(5, 6, 4, 1),
220+
Interactions = c(8, 9),
221221
Controls = c(2, 3, 7)
222-
)) # gear 4 and 5, drat
222+
))
223223
```
224224

225225
If you prefer tables without vertical borders, use the `sep` argument to define the string that is used as border-separator. This argument is passed down to `insight::export_table()`.
@@ -229,8 +229,8 @@ If you prefer tables without vertical borders, use the `sep` argument to define
229229
print(mp,
230230
sep = " ",
231231
groups = list(
232-
Engine = c("cyl6", "cyl8", "vs", "hp"),
233-
Interactions = c("gear4:vs", "gear5:vs"),
232+
Engine = c(5, 6, 4, 1),
233+
Interactions = c(8, 9),
234234
Controls = c(2, 3, 7)
235235
)
236236
)
@@ -382,6 +382,6 @@ print(tab, table_width = 80)
382382

383383
# More advances tables and markdown / HTML formatting
384384

385-
The `print_md()` as well as `print_html()` functions can be used to create markdown (for knitting to PDF or Word) and HTML tables.
385+
The `print_md()` as well as `print_html()` functions can be used to create markdown (for knitting to PDF or Word) and HTML tables, where HTML tables are created using the [**gt**](https://gt.rstudio.com/) package. There is also a `display()` function, which internally calls `print_md()` or `print_html()`, depending on the `format` argument. However, for `display()`, the `format` argument can also be `"tt"` to use the [**tinytable**](https://vincentarelbundock.github.io/tinytable/) package as engine to produce tables. This will create tables in different output formats, depending on the environment where the code is run (e.g. R Markdown, Jupyter Notebook, etc.).
386386

387387
Meanwhile, there are a lot of additional packages that allow users to have even more flexibility regarding table layouts. One package we can recommend is the [*modelsummary* package](https://vincentarelbundock.github.io/modelsummary/).

0 commit comments

Comments
 (0)