Custom infix functions are one of my favorite features in R. This article is my love letter to them. But first, a quick recap.
For those unfamiliar with the terminology, infix function is a function
funwhich is called using
infix notation, e.g.,
x fun yinstead of
fun(x, y). Those functions are also called infix operators by base R, and I will use those terms and name infixes interchangeably. There are a lot of infix operators in base R used very frequently, i.e., arithmetic or logical operators. We use them so often that we usually forget that they are functions. And that we can call them just like regular functions.
Infix functions are something I tend to forget entirely about developing on my own but they can be extremely useful, as Dominik shows. H/T R-Bloggers.