pharmaverse/tidytlg

Error when applying the 'wcol' argument of gentlg

Closed this issue · 0 comments

When a vector of numbers specifying different column lengths is used in wcol argument of gentlg, it throws an error: “Error: wcol’s length must be 1 or the length of final output”. The reprex is below:

library(dplyr)
library(tidytlg)

adsl <- cdisc_adsl
adae <- cdisc_adae

adsl <- adsl %>%
filter(SAFFL == "Y") %>%
select(USUBJID, SAFFL, TRT01AN, TRT01A)

adae <- adae %>%
filter(SAFFL == "Y" & TRTEMFL == "Y") %>%
mutate(BSPT = paste(AEBODSYS, "[", AEDECOD, "]"),
SAEFL = if_else(AESER == "Y", "Yes", "No"),
DTHFL = if_else(AEOUT == "FATAL", "Yes", "No")) %>%
select(USUBJID, ASTDY, TRTA, BSPT, AETERM, SAEFL, DTHFL)

tbl <- inner_join(adsl, adae, by = "USUBJID") %>%
arrange(TRT01AN, USUBJID, ASTDY) %>%
select(TRT01A, USUBJID, ASTDY, TRTA, BSPT, AETERM, SAEFL, DTHFL) %>%
filter(USUBJID %in% c("01-701-1015", "01-701-1023"))

gentlg(huxme = tbl,
tlf = "l",
orientation = "landscape",
file = "Listing01",
title = "Listing of Adverse Events",
idvars = c("TRT01A", "USUBJID"),
wcol = c(0.1, 0.1, 0.05, 0.1, 0.25, 0.2, 0.1, 0.1),
colheader = c("Treatment Group",
"Subject ID",
"Study Day of AE",
"Treatment Period",
"Body System [Preferred Term]",
"Verbatim Term",
"Serious",
"Fatal"))

Error: wcol's length must be 1 or the length of final output

The tbl only includes the columns for displaying the listing without any formatting columns such as indentme, newrows, and anbr. If anbr is included in tbl, this error will go away. However, in previous version of tidytlg, the wcol argument worked fine even the tbl just have the displaying columns.