Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 01_line_breaks.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ gt_table <- tbl$table_body |>
stat_2 = gt::md("**Drug B** \nManual Line Break")
) |>
gt::tab_header(gt::md("This is the Title \nwith a linebreak"), subtitle = "This is the Subtitle")

gt_table
```

### gt_save PDF
Expand All @@ -54,7 +56,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/linebreaks_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down Expand Up @@ -90,7 +91,6 @@ doconv::docx2pdf("outputs/docx/linebreaks_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/linebreaks_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
2 changes: 2 additions & 0 deletions 02_indentation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ gt_table <- tbl$table_body |>
locations = gt::cells_body(columns = label, rows = row_type %in% "missing"),
fn = function(x) paste0(strrep("\U00A0", times = 4), x)
)

gt_table
```

### gt_save PDF
Expand Down
5 changes: 2 additions & 3 deletions 03_spanning_header.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ gt_table <- tbl$table_body |>
gt::tab_spanner(gt::md("**Spanning Level 2**"), columns = gtsummary::all_stat_cols(), level = 2L, id = "stat_1_L2") |>
gt::tab_spanner(gt::md("**Spanning Level 1**"), columns = gtsummary::all_stat_cols(FALSE), level = 1L, id = "stat_1_L1") |>
gt::tab_spanner(gt::md("**Both Treatments**"), columns = stat_0, level = 1L, id = "stat_0_L1")

gt_table
```

### gt_save PDF
Expand Down Expand Up @@ -57,7 +59,6 @@ doconv::docx2pdf("outputs/docx/spanning_header_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/spanning_header_gt_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -73,7 +74,6 @@ doconv::docx2pdf("outputs/docx/spanning_header_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/spanning_header_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -89,7 +89,6 @@ doconv::docx2pdf("outputs/docx/spanning_header_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/spanning_header_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
6 changes: 2 additions & 4 deletions 04_footnotes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ gt_table <- tbl$table_body |>
gt::tab_footnote("Footnote in Spanning Header", locations = gt::cells_column_spanners(spanners = "stat_1_L1")) |>
gt::tab_footnote("Footnote in Subtitle", locations = gt::cells_title("subtitle")) |>
gt::tab_footnote("Footnote in Title", locations = gt::cells_title("title"))

gt_table
```

### gt_save PDF
Expand All @@ -42,7 +44,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/footnotes_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -58,7 +59,6 @@ doconv::docx2pdf("outputs/docx/footnotes_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/footnotes_gt_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -72,7 +72,6 @@ gt_table
# converting word to pdf locally
doconv::docx2pdf("outputs/docx/footnotes_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/footnotes_qmd_word.pdf){width="80%" height="1000"}
Expand All @@ -90,7 +89,6 @@ doconv::docx2pdf("outputs/docx/footnotes_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/footnotes_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
7 changes: 2 additions & 5 deletions 05_source_notes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ gt_table <- tbl$table_body |>
gt::tab_source_note("This is Source Note 1") |>
gt::tab_source_note("This is Source Note 2") |>
gt::tab_source_note("Abbreviations: Q1 = First Quartile; Q3 = Third Quartile")

gt_table
```

### gt_save PDF

```{r eval = FALSE}
gt::gtsave(gt_table, filename = "outputs/pdf/source_notes_gt_pdf.pdf")
```

###### Preview the Output

![](outputs/pdf/footnotes_gt_pdf.pdf){width="80%" height="1000"}
Expand All @@ -38,7 +39,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/source_notes_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -54,7 +54,6 @@ doconv::docx2pdf("outputs/docx/source_notes_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/source_notes_gt_word.docx){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -70,7 +69,6 @@ doconv::docx2pdf("outputs/docx/source_notes_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/source_notes_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -86,7 +84,6 @@ doconv::docx2pdf("outputs/docx/source_notes_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/source_notes_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
7 changes: 2 additions & 5 deletions 06_titles.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ gt_table <- tbl$table_body |>
gt::sub_missing(missing_text = "") |>
# title, subtitle, and captions
gt::tab_header(gt::md("This is the Title"), subtitle = "This is the Subtitle")

gt_table
```

### gt_save PDF
Expand All @@ -25,7 +27,6 @@ gt::gtsave(gt_table, filename = "outputs/pdf/titles_gt_pdf.pdf")
```

###### Preview the Output

![](outputs/pdf/titles_gt_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -39,7 +40,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/titles_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -55,7 +55,6 @@ doconv::docx2pdf("outputs/docx/titles_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/titles_gt_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -72,7 +71,6 @@ doconv::docx2pdf("outputs/docx/titles_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/titles_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -89,7 +87,6 @@ doconv::docx2pdf("outputs/docx/titles_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/titles_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
3 changes: 3 additions & 0 deletions 07_alignment.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Alignment"
format: html
editor: visual
---
## Testing Alignments output

```{r eval=FALSE}

Expand All @@ -14,6 +15,8 @@ gt_table <- tbl$table_body |>
gt::cols_align(columns = c(stat_1, stat_2), align = "right") |>
gt::cols_align(columns = c(variable, var_type), align = "center") |>
gt::cols_align(columns = c(row_type, var_label), align = "left")

gt_table
```

### gt_save PDF
Expand Down
9 changes: 3 additions & 6 deletions 08_text_styling.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: "Text Styling"
format: html
editor: visual
---
## Testing Text Styling output

```{r eval=FALSE}

library(gtsummary)
tbl <- gtsummary::tbl_summary(gtsummary::trial, by = trt, include = c(age, grade), missing = "always", label = list(age = "Age")) |> add_overall()

Expand All @@ -16,6 +16,8 @@ gt_table <- tbl$table_body |>
style = gt::cell_text(weight = "bold"),
locations = gt::cells_body(columns = "label", rows = c(1, 3))
)

gt_table
```

### gt_save PDF
Expand All @@ -25,7 +27,6 @@ gt::gtsave(gt_table, filename = "outputs/pdf/bold_gt_pdf.pdf")
```

###### Preview the Output

![](outputs/pdf/bold_gt_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -39,7 +40,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/bold_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -55,7 +55,6 @@ doconv::docx2pdf("outputs/docx/bold_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/bold_gt_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -71,7 +70,6 @@ doconv::docx2pdf("outputs/docx/text_style_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/text_style_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -87,7 +85,6 @@ doconv::docx2pdf("outputs/docx/text_style_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/bold_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
9 changes: 3 additions & 6 deletions 09_tbl_too_long.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ editor: visual

Testing when the table is too long to fit on the page (vertical pagination).

```{r eval=FALSE}
```{r eval=T}

library(gtsummary)
library(dplyr)
Expand Down Expand Up @@ -68,6 +68,8 @@ summary_table <- data %>%
modify_header(label = "**Characteristic**", estimate = "**Mean (SD) or N (%)**") %>%
modify_table_styling(columns = everything())

summary_table

```

### gt_save PDF
Expand All @@ -77,7 +79,6 @@ gt::gtsave(as_gt(summary_table), filename = "outputs/pdf/too_long_gt_pdf.pdf")
```

###### Preview the Output

![](outputs/pdf/too_long_gt_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -92,7 +93,6 @@ gt_table
```

###### Preview the Output

![](outputs/pdf/too_long_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -109,7 +109,6 @@ doconv::docx2pdf("outputs/docx/too_long_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/too_long_gt_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -127,7 +126,6 @@ doconv::docx2pdf("outputs/docx/too_long_qmd_word.docx")
```

###### Preview the Output

![](outputs/docx/too_long_qmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -145,7 +143,6 @@ doconv::docx2pdf("outputs/docx/too_long_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/too_long_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
8 changes: 3 additions & 5 deletions 10_tbl_too_wide.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ editor: visual

Testing what happens when the table is too wide (horizontal pagination)

```{r eval=FALSE}
```{r eval=T}
library(gtsummary)
library(dplyr)

Expand Down Expand Up @@ -67,6 +67,8 @@ summary_table <- data %>%
modify_header(label = "**Characteristic**", estimate = "**Mean (SD) or N (%)**") %>%
modify_table_styling(columns = everything()) %>%
add_overall() # This adds an overall column

summary_table
```

### gt_save PDF
Expand All @@ -76,7 +78,6 @@ gt::gtsave(as_gt(summary_table), filename = "outputs/pdf/too_wide_gt_pdf.pdf")
```

###### Preview the Output

![](outputs/pdf/too_wide_gt_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -90,7 +91,6 @@ summary_table
```

###### Preview the Output

![](outputs/pdf/too_wide_rmd_pdf.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand All @@ -104,7 +104,6 @@ gt::gtsave(as_gt(summary_table), filename = "outputs/docx/too_wide_gt_word.docx"
# converting word to pdf locally
doconv::docx2pdf("outputs/docx/too_wide_gt_word.docx")
```

###### Preview the Output

![](outputs/docx/too_wide_gt_word.pdf){width="80%" height="1000"}
Expand Down Expand Up @@ -138,7 +137,6 @@ doconv::docx2pdf("outputs/docx/too_wide_rmd_word.docx")
```

###### Preview the Output

![](outputs/docx/too_wide_rmd_word.pdf){width="80%" height="1000"}

| | Date | Finding |
Expand Down
Loading