I am trying to integrate binary arithmetic operators in the native pipe.
Reproducible example:
# without pipe
round(sample(1:2, 1) / 3, 2)
## [1] 0.33
# with pipe
1:2 |> sample(1) / 3 |> round(2)
## [1] 0.3333333 # round is ignored
1:2 |> (sample(1) / 3) |> round(2)
## Error: function '(' not supported in RHS call of a pipe
1:2 |> sample(1) |> '/'(3) |> round(2)
## Error: function '/' not supported in RHS call of a pipe
How can I achieve the same result with a pipe?