| derive | R Documentation |
derive() returns a function computing a history-derived feature as of (j, t). Intended to populate Entity$derived_vars and be used by Entity$snapshot*().
derive(
name,
target,
lookback_t = NULL,
lookback_j = NULL,
fn = c("count", "min", "max", "mean", "median", "sd", "iqr", "any", "all"),
include_current = TRUE,
force = FALSE,
na_value = NA,
clock = "time"
)
name |
Name of the derived feature. |
target |
A target created by event() or declare_variable(). |
lookback_t |
Optional numeric lookback window on the time axis. Takes precedence over lookback_j. |
lookback_j |
Optional integer lookback window in event-index units. |
fn |
Summary function name. For event() targets, only count, any, and all are supported. |
include_current |
Logical; include the boundary event at t/j (default TRUE). |
force |
Logical; if TRUE, return a value when there is no history (default FALSE). |
na_value |
Value to return when force=TRUE and no history exists (default NA). |
clock |
Which column in entity$events defines the time axis for lookback_t (default "time"). |
A function (entity, j, t) -> scalar or NULL.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.