Skip to content

Commit

Permalink
Update ARM and ACTARM.
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi Liu committed Sep 28, 2024
1 parent 55f8550 commit b079041
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/radab.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ radab <- function(adsl,
}

# validate and initialize related variables
param_init_list <- relvar_init(param, paramcd)
unit_init_list <- relvar_init(param, avalu)
param_init_list <- random.cdisc.data:::relvar_init(param, paramcd)
unit_init_list <- random.cdisc.data:::relvar_init(param, avalu)

adpc <- adpc %>% dplyr::filter(ASMED == "PLASMA")
adab0 <- expand.grid(
Expand Down Expand Up @@ -386,6 +386,11 @@ radab <- function(adsl,
last_ada
))

# Carry over ARM and ACTARM for all records.
arm <- adab %>% filter(!is.na(ARM), !is.na(ACTARM)) %>% select(USUBJID, ARM, ACTARM) %>% distinct(.)
adab$ARM <- arm$ARM[match(adab$USUBJID, arm$USUBJID)]
adab$ACTARM <- arm$ACTARM[match(adab$USUBJID, arm$USUBJID)]

if (length(na_vars) > 0 && na_percentage > 0) {
adab <- mutate_na(ds = adab, na_vars = na_vars, na_percentage = na_percentage)
}
Expand Down

0 comments on commit b079041

Please sign in to comment.