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

Correct SERREAS derivation in ael03 #284

Merged
merged 12 commits into from
Dec 2, 2024
22 changes: 13 additions & 9 deletions book/listings/adverse-events/ael03.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>%
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
<chr> <int> <dbl> <fct> <chr> <dbl> <chr> <dbl> <chr>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
<chr> <int> <dbl> <fct> <chr> <dbl> <chr> <dbl> <chr>
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
Expand Down