math_to_function: Convert a half-complete math condition to a function.

View source: R/functional.R

math_to_functionR Documentation

Convert a half-complete math condition to a function.

Description

Takes a string like "<0" and outputs a function to test for that condition. Returns a boolean.

Usage

math_to_function(str, convert_equal = T, silent_try = T, test_function = T)

Arguments

str

(chr scalar) A string of a half math conditional

convert_equal

(log scalar) Converts = to ==. Default=T.

silent_try

(log scalar) Whether to use a silent trial. Default=T. Change to F to get potentially useful debugging information.

test_function

(log scalar) Whether to test the function. This is done by trying on 0. Default=T.

Examples

math_to_function("<0")(-1) #check if -1<0
math_to_function("=0")(1234) #check if 1235=0

Deleetdk/kirkegaard documentation built on Sept. 28, 2024, 1:51 p.m.