Given a R expression which represents a sum of terms like
expr <- expression(a + b * c + d + e * f)
I would like to retrieve the set of all the terms of the sum as a list
of names or expressions. So in the example, the elements would be: a
, b * c
, d
and e * f
.
The following comes from a comment.
The tems could themselves contain a
+
operator as inexpression(a + b * c + d + e * (f + g))
so we need some understanding of the R language.
Is there a simple way to proceed e.g., using call_tree
of the pryr package?