Trigger Analysis at a Sample Fraction
trigger_by_fraction.RdBuilds a Condition that fires when a given fraction of the target sample
has been enrolled. The returned Condition should be passed to
Trial$new(conditions = list(...)).
Arguments
- fraction
numericSample fraction (0 < fraction <= 1).- sample_size
integerTarget sample size.- analysis
functionorNULLOptional analysis function called asanalysis(filtered_data, current_time). IfNULL, the filtered snapshot is returned as-is with a warning.- name
characterorNULLResult key. Defaults to"frac_<fraction>".
Value
A Condition object.
Examples
cond <- trigger_by_fraction(
fraction = 0.5,
sample_size = 100,
analysis = function(df, current_time) {
data.frame(n_enrolled = sum(!is.na(df$enroll_time)))
}
)