diff --git a/book/listings/adverse-events/ael03.qmd b/book/listings/adverse-events/ael03.qmd index 3cbdd165ff..35bc6e739d 100644 --- a/book/listings/adverse-events/ael03.qmd +++ b/book/listings/adverse-events/ael03.qmd @@ -12,6 +12,7 @@ library(dplyr) library(rlistings) adae <- random.cdisc.data::cadae +adae$AESCONG[which(adae$AESER == "Y")[seq(3)]] <- "Y" # To mimic possibility of overlap out <- adae %>% filter(AESER == "Y") %>% @@ -38,17 +39,20 @@ out <- adae %>% AEACN == "DRUG WITHDRAWN" ~ 5, AEACN == "NOT APPLICABLE" | AEACN == "NOT EVALUABLE" ~ 6, AEACN == "UNKNOWN" ~ 7 - ), - SERREAS = case_when( - AESDTH == "Y" ~ "1", - AESLIFE == "Y" ~ "2", - AESHOSP == "Y" ~ "3", - AESDISAB == "Y" ~ "4", - AESCONG == "Y" ~ "5", - AESMIE == "Y" ~ "6", - TRUE ~ " " ) ) %>% + rowwise() %>% + mutate( + SERREAS = paste( + which( + c(AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE) == "Y" + ), + collapse = ", " + ) + ) %>% + ungroup() + +out <- out %>% select(CPID, ASR, TRT01A, AEDECOD, Date_First, ASTDY, Duration, AESEV, Related, Outcome, Treated, Action, SERREAS) var_labels(out) <- c( diff --git a/package/DESCRIPTION b/package/DESCRIPTION index c0286f0a72..1e836ec4fa 100644 --- a/package/DESCRIPTION +++ b/package/DESCRIPTION @@ -1,6 +1,6 @@ Package: tlg.catalog.pkg Title: Tables, Listings and Graphs Catalog -Version: 0.1.0.9038 +Version: 0.1.0.9039 Authors@R: c( person("Joe", "Zhu", , "joe.zhu@roche.com", role = c("aut", "cre")), person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"), diff --git a/package/NEWS.md b/package/NEWS.md index f2f3319e53..af1633b271 100644 --- a/package/NEWS.md +++ b/package/NEWS.md @@ -1,4 +1,4 @@ -# `tlg-catalog` 0.1.0.9038 +# `tlg-catalog` 0.1.0.9039 - Reorganize files into `/book` and `/package` for testability purposes. - The TLG Catalog is here! diff --git a/package/tests/testthat/_snaps/development/listings-adverse-events-ael03.md b/package/tests/testthat/_snaps/development/listings-adverse-events-ael03.md index a08ecc094d..675faf4de7 100644 --- a/package/tests/testthat/_snaps/development/listings-adverse-events-ael03.md +++ b/package/tests/testthat/_snaps/development/listings-adverse-events-ael03.md @@ -18,7 +18,7 @@ 10 A: Drug X BRA-1/id-93 34/F/ASIAN dcd D.1.1.1.1 Date_First ASTDY Duration AESEV Related Outcome Treated Action SERREAS - 1 04NOV2020 321 149 MODERATE No 5 Yes 2 4 + 1 04NOV2020 321 149 MODERATE No 5 Yes 2 4, 5 2 04NOV2020 393 43 MODERATE No 5 No 5 5 3 01JAN2020 64 630 SEVERE Yes 1 No 6 1 4 01JAN2020 160 259 MODERATE No 2 Yes 2 4 diff --git a/package/tests/testthat/_snaps/stable/listings-adverse-events-ael03.md b/package/tests/testthat/_snaps/stable/listings-adverse-events-ael03.md index a65bcc03ff..336805654e 100644 --- a/package/tests/testthat/_snaps/stable/listings-adverse-events-ael03.md +++ b/package/tests/testthat/_snaps/stable/listings-adverse-events-ael03.md @@ -18,7 +18,7 @@ 10 A: Drug X BRA-1/id-93 34/F/ASIAN dcd D.1.1.1.1 Date_First ASTDY Duration AESEV Related Outcome Treated Action SERREAS - 1 04NOV2020 321 149 MODERATE No 5 Yes 2 4 + 1 04NOV2020 321 149 MODERATE No 5 Yes 2 4, 5 2 04NOV2020 393 43 MODERATE No 5 No 5 5 3 01JAN2020 64 630 SEVERE Yes 1 No 6 1 4 01JAN2020 160 259 MODERATE No 2 Yes 2 4