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
.
Value
A vector of values where expression is true.