Safe alternative to using eval + parse on some string that has already been converted into a tree.
eval_tree(
tree,
singular_operators = NULL,
binary_operators = NULL,
valid_functions = NULL,
map = NULL,
mapping_names = NULL
)numeric or logical vector
the output object from create_tree
tokens of length 1 that operate on a right hand value. For example, the `-` token is an operator to negate a vector. NULL value will be replaced with c("-", "!").
tokens of any length that operate on a left and right hand values. For example, the `+` token is an operator that adds a left vector to a right vector. NULL value will be replaced with c(",", "|", "&", "<=", "<", ">=", ">", "==", "!=", "+", "-", "*", "%/%", "/", "%%", "%in%", ":", "^"). The order determines the precedence of the operators.
tokens of any length that are prefixed on a parenthesis block and specify a function to run on the provided parameters within the block. For example, the `log` token will evaluate the logarithm value of the first parameter. Note named parameters are not support. NULL value will be replaced with c("log", "c", "any", "all", "abs", "ifelse").
a named list of data.frames/lists/matrices. Where names are keys for referencing the values in the text parameters.
optional argument to make the function faster or limit which map elements can be referenced.
See vignette("Overview", package = "evalR")
tree <- create_tree("1 + 2")
eval_tree(tree)
Run the code above in your browser using DataLab