Evaluate a Comparison Expression Without eval(parse())
Source:R/forestsearch_helpers.R
evaluate_comparison.RdParses a string of the form "var op value" and evaluates it
directly against a data frame column using operator dispatch. Falls back
to column-name lookup for bare names.
Details
Supported operators (matched longest-first to avoid partial-match
ambiguity): <=, >=, !=, ==, <,
>.
If no operator is found, expr is treated as a column name and
the result is df[[expr]] == 1.
The value on the right-hand side is coerced to numeric when possible, otherwise kept as character for string comparisons.