In R left-to-right associativity is the norm, for instance:
5 - 3 - 1 == (5 - 3) - 1 # TRUE
5 - 3 - 1 == 5 - (3 - 1) # FALSE
Is there a way to get right-to-left associativity instead, for a given operator?
Note that I am aware of this post; however it does not answer my question above, here is why:
library(backpipe)
"%diff%" <- function(x, y) y - x
"%-%" <- backpipe("%diff%")
5 %-% 3 %-% 1 == (5 %-% 3) %-% 1 # TRUE
5 %-% 3 %-% 1 == 5 %-% (3 %-% 1) # FALSE