I would like to have an infix operator %between% in R -- to check to see if x is between lower bound l and upper bound
%between%
R
x
l
You can define infix operators as functions:
`%between%`<-function(x,rng) x>rng[1] & x
As pointed out by @flodel, this operator is vectorized:
1:5 %between% c(1.5,3.5) # [1] FALSE TRUE TRUE FALSE FALSE