A variable is a scalar, real-valued function \(f(i, t)\) written with
the data pronouns .i$field, .t, .b and .x. A static_variable is a
variable that does not depend on time – a function of the individual's
facts alone, \(f(i)\).
Construct one from a pronoun expression or a ~ formula. The constructors
return the most specific type they can prove: a time-invariant
expression becomes a static_variable, and one that is also structurally
logical becomes an indicator. static_variable() additionally asserts that
the expression does not use .t (and fails if it does); indicator()
asserts a \(\{0,1\}\) value. So variable(.i$pension) is a
static_variable and variable(.i$pension > 0) is an indicator.
value() evaluates the variable against a single individual's facts .i
(a named list) and a time vector .t. It is the plain-R reference path for
testing and understanding – not the performance path. For a
static_variable, .t may be omitted.
Usage
variable(expr)
static_variable(expr)
is_variable(x)
is_static_variable(x)
value(x, .i, .t = NULL, ...)
# Default S3 method
value(x, .i, .t = NULL, ...)
# S3 method for class 'variable'
value(x, .i, .t = NULL, ...)