pharmaverse/tidytlg

Clear footers when they are of length zero

Closed this issue · 2 comments

library(tidytlg)
 
final <- data.frame(
  label = c(
    "Overall", "Safety Analysis Set",
    "Any Adverse event{\\super a}", "- Serious Adverse Event"
  ),
  Drug_A = c("", "40", "10 (25%)", "0"),
  Drug_B = c("", "40", "10 (25%)", "0"),
  anbr = c(1, 2, 3, 4),
  roworder = c(1, 1, 1, 1),
  boldme = c(1, 0, 0, 0),
  newrows = c(0, 0, 1, 0),
  indentme = c(0, 0, 0, 1),
  newpage = c(0, 0, 0, 0)
)
 
# Produce output in rtf format
 
## footnote is blank
gentlg(
  huxme = final,
  wcol = c(0.70, 0.15, 0.15),
  file = "TSFAEX",
  title = "This is Amazing Demonstration 1",
  colheader = c(" ","Drug A","Drug B"),
  footers = ""
)
 
## footenote is NA
gentlg(
  huxme = final,
  wcol = c(0.70, 0.15, 0.15),
  file = "TSFAEX",
  title = "This is Amazing Demonstration 1",
  colheader = c(" ","Drug A","Drug B"),
  footers = character(0)
)
 
## footnote is NULL, and this is the correct output
gentlg(
  huxme = final,
  wcol = c(0.70, 0.15, 0.15),
  file = "TSFAEX",
  title = "This is Amazing Demonstration 1",
  colheader = c(" ","Drug A","Drug B"),
  footers = NULL
)

From @shengwei66 :
So the update we need is to make footers as NULL when it's "" or character(0) or NA

@kpagacz We just need the footers as NULL when it's character(0) or NA.

We want to keep the current behavior when it's "". So no update for "".