create_tree {evalR} | R Documentation |
Convert a statement into an evaluation tree
Description
function will break text
into a list of lists.
Usage
create_tree(
text,
singular_operators = NULL,
binary_operators = NULL,
valid_functions = NULL
)
Arguments
text |
the string/code/statement you want to parse. |
singular_operators |
tokens of length 1 that operate on a right hand value. For example, the '-' token is an operator to negate a vector. |
binary_operators |
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. |
valid_functions |
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. |
Details
See vignette("Overview", package = "evalR")
Value
a list of lists. In other words, a tree data structure made from lists.
Examples
x <- create_tree("2 * (3 + 5)")
str(x)