pharmaverse / tidytlg

The goal of tidytlg is to generate tables, listings, and graphs (TLG) using Tidyverse.
https://pharmaverse.github.io/tidytlg/
Other
33 stars 6 forks source link

feat: changed the style of the table header in the RTF output #33

Closed kpagacz closed 5 months ago

kpagacz commented 5 months ago
kpagacz commented 5 months ago

The way the RTF files look in word should stay the same. Here's some code to generate the multiple tables:

devtools::load_all(".")

tbl <- data.frame(
  label = "Subjects with ≥ 1 concomitant medication",
  col1 = "1 (100.0%)",
  col2 = "1 (100.0%)",
  col3 = "2 (100.0%)",
  col4 = "1 (100.0%)",
  col5 = "3 (100.0%)",
  row_type = "VALUE"
)

tbl2 <- data.frame(
  label = "Subjects with ≥ 1 concomitant medication",
  col1 = "1 (100.0%)",
  col2 = "1 (100.0%)",
  col3 = "2 (100.0%)",
  col4 = "1 (100.0%)",
  col5 = "3 (100.0%)",
  row_type = "VALUE"
)

gentlg(
  huxme = tbl,
  orientation = "landscape",
  file = "no-borders",
  title = "Summary of Concomitant Medications",
  colspan = list(
    c("", "Active Study Agent", "Active Study Agent", "Active Study Agent", "", ""),
    c("", "Treatment 1", "Treatment 1", "Treatment 2", "Combined", "Total")
  ),
  colheader = c(" Standardized medication name", "N=1", "N=1", "N=2", "N=1", "N=3"),
  wcol = .30
)

gentlg(
  huxme = list(tbl, tbl2),
  orientation = "landscape",
  file = "no-borders",
  title = "Summary of Concomitant Medications",
  colspan = list(
    c("", "Active Study Agent", "Active Study Agent", "Active Study Agent", "", ""),
    c("", "Treatment 1", "Treatment 1", "Treatment 2", "Combined", "Total")
  ),
  colheader = c(" Standardized medication name", "N=1", "N=1", "N=2", "N=1", "N=3"),
  wcol = .30
)