Skip to content

Commit

Permalink
Assign value for AEACN
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Wang committed Jan 31, 2025
1 parent aab6a5e commit 059b034
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions R/meta_ae_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,21 @@ meta_ae_example <- function() {
}

# AE action
adae$AEACN <- gsub("", "DOSE NOT CHANGED", adae$AEACN)
adae$AEACN <- sample(
x = c("DOSE NOT CHANGED", "DRUG INTERRUPTED", "DRUG WITHDRAWN", "NOT APPLICABLE", "UNKNOWN"),
size = length(adae$USUBJID),
prob = c(0.7, 0.1,0.05,0.1,0.05), replace = TRUE
)

for (i in seq_along(adae$AEACN)) {
adae$action_taken[i] <- switch(adae$AEACN[i],
"DOSE NOT CHANGED" = "None",
"DOSE REDUCED" = "Reduced",
"DRUG INTERRUPTED" = "Interrupted",
"DOSE INCREASED" = "Increased",
"NOT APPLICABLE" = "N/A",
"UNKNOWN" = "Unknown",
"''" = "None",
tools::toTitleCase(tolower(adae$AEACN[i]))
adae$action_taken[i] <- switch(adae$AEACN[i],
"DOSE NOT CHANGED" = "None",
"DRUG INTERRUPTED" = "Interrupted",
"DRUG WITHDRAWN" = "Discontinued",
"NOT APPLICABLE" = "N/A",
"UNKNOWN" = "Unknown",
"''" = "None",
tools::toTitleCase(tolower(adae$AEACN[i]))
)
}

Expand Down

0 comments on commit 059b034

Please sign in to comment.