pharmaverse/tidytlg

Spanning header format issues in gentlg.R

Closed this issue · 1 comments

When there are multiple levels of spanning headers specified in the colspan argument of the gentlg function, there are some formatting issues of spanning row lines. The reprex for illustrating these issues is shown below:

library(dplyr)
library(tidytlg)

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"
)

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

The image of the rtf output with issue annotations is shown below:
Spanning_cols_issues

The issues are described below:

  1. the spanning row line below ‘Active Study Agent’ and ‘x’ should have a break.
  2. a new feature in gentlg to control the spanning row line between the treatment and N=xxx (i.e. to toggle on/off the line). The current output created by gentlg shown above has a solid line between the treatment and N=xxx.
  3. a solid line should span across the entire page under the first row of the column header (i.e. start the solid line from the label column). The solid line in the current output starts from the column of 'col1'.

I've reviewed and have a few questions.

  1. Question: Will column 1 still have a solid line if there is no column header here? Answer: There will always be a line.
  2. Question: Will column 2 to column always have a solid line? What if there are no spanning headers? Would this need breaks or still be a solid line? Answer: Always need a solid line.

It seems we need to add robust column header controls to allow users to toggle all levels of spanning headers and the column header.

  • Feature to toggle underline or no underline for all column headers and all column spanning headers.
  • Feature to toggle a break or no break between underlines for column headers and column spanning headers.