Understanding: `+`(1, `*`(2, 3)) and how to better code it

r

Solution

If you use operators with quotes (e.g. ``+`` or ``*``), you are actually using the standard operators with the typical `function` syntax.

Let's say you want to calculate `1 + 2` using that way. You could do it this way:

`+`(1, 2) ## Please call the sum operator using 1 and 2 as arguments.

So, since the expression you have posted is ``+`(1, `*`(2, 3))`, it's basically the sum operator, for which the arguments are `1` and the result of the product operator, for which the arguments are `2` and `3`.

Eventually, a typical way to do this is `1 + (2 * 3)`.

Problem

What is this code: ``+`(1, `*`(2, 3))` supposed to be doing in R? Can it be coded in a more typical way? How?

Original source