Skip to contents

Builds a Condition that fires when the trial clock reaches a specified calendar time. The returned Condition should be passed to Trial$new(conditions = list(...)).

Usage

trigger_by_calendar(cal_time, analysis = NULL, name = NULL)

Arguments

cal_time

numeric Calendar time(s) at which to trigger.

analysis

function or NULL Optional analysis function called as analysis(filtered_data, current_time). If NULL, the filtered snapshot is returned as-is with a warning.

name

character or NULL Result key. Defaults to "cal_time_<cal_time>".

Value

A Condition object.

Examples

cond <- trigger_by_calendar(
  cal_time = 12,
  analysis = function(df, current_time) {
    data.frame(n_enrolled = sum(!is.na(df$enroll_time)))
  }
)