Skip to contents

Convenience constructor: wraps Condition$new() with a calendar_trigger(). The returned Condition should be passed to Trial$new(conditions = list(...)).

Usage

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

Arguments

cal_time

numeric Calendar time at or after which to fire.

analysis

function or NULL Called as analysis(df, 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 <- condition_calendar_time(
  cal_time = 12,
  analysis = function(df, current_time) {
    data.frame(n_enrolled = sum(!is.na(df$enroll_time)))
  }
)