Skip to content

Commit

Permalink
Correct SERREAS derivation in ael03
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Nov 12, 2024
1 parent dfb9f12 commit 46d3361
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions book/listings/adverse-events/ael03.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ subtitle: Listing of Serious Adverse Events

{{< include ../../_utils/envir_hook.qmd >}}

:::: {.panel-tabset}

::: panel-tabset
```{r setup, echo = FALSE}
library(dplyr)
library(rlistings)
adae <- random.cdisc.data::cadae
adae$AESCONG[which(adae$AESER == "Y")[seq(3)]] <- "Y" # To mimick correct possibility of overlap
out <- adae %>%
filter(AESER == "Y") %>%
Expand All @@ -40,17 +40,23 @@ 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()
# Check correct derivation of SERREAS
# out |> select(AESDTH, AESLIFE, AESHOSP, AESDISAB, AESCONG, AESMIE, SERREAS)
out <- out %>%
select(CPID, ASR, TRT01A, AEDECOD, Date_First, ASTDY, Duration, AESEV, Related, Outcome, Treated, Action, SERREAS)
var_labels(out) <- c(
Expand Down Expand Up @@ -99,17 +105,15 @@ lsting <- as_listing(
head(lsting, 20)
```

`r webr_code_labels <- c("setup", "lsting")`
{{< include ../../_utils/webr.qmd >}}
`r webr_code_labels <- c("setup", "lsting")` {{< include ../../_utils/webr.qmd >}}
:::

## Data Setup

```{r setup}
#| code-fold: show
```

::::
:::

{{< include ../../_utils/save_results.qmd >}}

Expand Down

0 comments on commit 46d3361

Please sign in to comment.