Creating expression tree in R
The substitute function in R creates a language object in the form of a tree that one can parse. How can I create the tree from scratch using list or else to then give it to eval? # substitute gives a tree representation of the expression a=1; b=2; e1 = substitute(a+2*b) eval(e1) #gives 5 as expected e1 # is type language e1[[1]] # this is `+` e1[[2]] # this is 'a' type symbol e1[[3]] # this is type language e1[[3]][[1]] # this is `*` etc.... I would like to know how I can reconstruct the e1 object programmatically. Ideally I create an object of intricated lists with the correct object in them