Creating expression tree in R

前端 未结 2 857
天涯浪人
天涯浪人 2021-02-02 18:27

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 g

2条回答
  •  终归单人心
    2021-02-02 18:50

    > plus <- .Primitive("+")
    > plus
    function (e1, e2)  .Primitive("+")
    > times=.Primitive("*")
    > eval(call("plus", b, call("times",2, b)))
    [1] 6
    > eval(call("plus", a, call("times",2, b)))
    [1] 5
    

提交回复
热议问题