Retain values within primary keys

retain(df, value_var, event, outside = NA)

Arguments

df

data frame in which to apply the retain.

value_var

variable containing the value to be retained.

event

flag to trigger the retain.

outside

value to.

Examples

ADLB <- radlb(radsl(N = 10, na_percentage = 0), na_vars = list())
ADLB$BASE2 <- random.cdisc.data:::retain(
  df = ADLB, value_var = ADLB$AVAL,
  event = ADLB$ABLFL2 == "Y"
)