Retain values within primary keys.
Usage
retain(df, value_var, event, outside = NA)
Arguments
- df
(data.frame
)
Data frame in which to apply the retain.
- value_var
(any
)
Variable in df
containing the value to be retained.
- event
(expression
)
Expression returning a logical value to trigger the retain.
- outside
(any
)
Additional value to retain. Defaults to NA
.
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"
)