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
gentlg(
huxme = final,
wcol = c(0.70, 0.15, 0.15),
file = "TSFAEX",
title = "This is Amazing Demonstration 1",
footers = c(
"Note: For demonstrative purposes only",
"{\\super a} Subjects are counted once for any given event."
)
)
# Pass in column headers instead of using variable name
gentlg(
huxme = final,
wcol = c(0.70, 0.15, 0.15),
file = "TSFAEX",
colheader = c("", "Drug A", "Drug B"),
title = "This is Amazing Demonstration 1",
footers = c(
"Note: For demonstrative purposes only",
"{\\super a} Subjects are counted once for any given event."
)
)
# Add spanning bottom borders under the cells in the second row
gentlg(
huxme = final,
wcol = c(0.70, 0.15, 0.15),
file = "TSFAEX",
colheader = c("", "Drug A", "Drug B"),
title = "This is Amazing Demonstration 1",
footers = c(
"Note: For demonstrative purposes only",
"{\\super a} Subjects are counted once for any given event."
),
border_fns = list(spanning_borders(2))
)
# Use a watermark
gentlg(
huxme = final,
wcol = c(0.70, 0.15, 0.15),
file = "TSFAEX",
colheader = c("", "Drug A", "Drug B"),
title = "This is Amazing Demonstration 1",
footers = c(
"Note: For demonstrative purposes only",
"{\\super a} Subjects are counted once for any given event."
),
watermark = "Confidential"
)
# Produce output in HTML format
hux <- gentlg(
huxme = final,
file = "TSFAEX",
colheader = c("", "Drug A", "Drug B"),
title = "This is Amazing Demonstration 1",
footers = c(
"Note: For demonstrative purposes only",
"{\\super a} Subjects are counted once for any given event."
),
watermark = "Confidential",
format = "HTML",
print.hux = FALSE
)
# Export to HTML page
huxtable::quick_html(hux, file = "TSFAEX.html", open = FALSE)
# clean up.
file.remove("TSFAEX.html", "tsfaex.rtf")
Run the code above in your browser using DataLab