Creates a prediction dataset with a treatment recommendation flag based
on the subgroup definition. Supports both label expressions
(e.g., "\{er <= 0\}") and bare column names (e.g., "q3.1").
get_dfpred(df.predict, sg.harm, version = 1)Data frame with treatment recommendation flag
(treat.recommend): 0 for harm subgroup, 1 for complement.
Data frame for prediction (test or validation set).
Character vector of subgroup-defining labels. Values may
be wrapped in braces and optionally negated, e.g. "\{er <= 0\}"
or "!\{size <= 35\}". Plain column names (e.g., "q3.1")
are treated as binary indicators that must equal 1.
Integer; encoding version (maintained for backward compatibility). Default: 1.
Each element of sg.harm is processed as follows:
Outer braces and leading ! are stripped.
If the result matches "var op value" (where op is
one of <=, <, >=, >, ==,
!=), the comparison is executed directly on
df.predict[[var]].
Otherwise the expression is treated as a column name and
membership is df.predict[[name]] == 1.
evaluate_comparison for the operator-dispatch
logic, forestsearch for the main analysis function.