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 u
.
I have created the following simple function -- but it's not an infix operation.
# between function - check to see if x is between l and u
is.between <- function(x, l, u) { x > l & x < u }
My aim is to replace this with: x %between% c(l, u)
Is it possible to define new infix operations? If so, how does one do this?
thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…