-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_titles.qmd
74 lines (50 loc) · 1.54 KB
/
06_titles.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: "Titles"
format: html
editor: visual
---
## Testing Title, Subtitle and Caption output
```{r}
library(gtsummary)
tbl <- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age")) |> add_overall()
gt_table <- tbl$table_body |>
gt::gt(caption = gt::md("This is the caption")) |>
gt::fmt_markdown(columns = label) |> # need this to recognize the line break in the table body
gt::cols_hide(columns = c(variable, var_type, row_type, var_label)) |>
gt::sub_missing(missing_text = "") |>
# title, subtitle, and captions
gt::tab_header(gt::md("This is the Title"), subtitle = "This is the Subtitle")
```
### gt_save PDF
```{r eval = FALSE}
gt::gtsave(gt_table, filename = "outputs/pdf/titles_gt_pdf.pdf")
```
[Preview the Output](outputs/pdf/titles_gt_pdf.pdf)
- no issues
### rmarkdown rendered PDF
```{r eval = FALSE}
gt_table
```
[Preview the Output](outputs/pdf/titles_rmd_pdf.pdf)
- no issues
### gt_save rendered word file
```{r eval = FALSE}
gt::gtsave(gt_table, filename = "outputs/docx/titles_gt_word.docx")
```
[Preview the Output](outputs/docx/titles_gt_word.docx)
- Titles present but right justified
- no caption
### quarto rendered word file
```{r eval = FALSE}
gt_table
```
[Preview the Output](outputs/docx/titles_qmd_word.docx)
- Titles present but right justified
- no caption
### rmarkdown rendered word file
```{r eval = FALSE}
gt_table
```
[Preview the Output](outputs/docx/titles_rmd_word.docx)
- Titles present but right justified
- no caption