Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when applying the 'wcol' argument of gentlg #14

Closed
shengwei66 opened this issue Jun 9, 2023 · 0 comments
Closed

Error when applying the 'wcol' argument of gentlg #14

shengwei66 opened this issue Jun 9, 2023 · 0 comments

Comments

@shengwei66
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants