Values inside interval
In closed interval: %[]%
In open interval: %()%
In half-closed interval (left): %[)%
In half-closed interval (right): %(]%
Return x in closed interval: %[.]%
Return x in open interval: %(.)%
Return x in half-closed interval (left): %[.)%
Return x in half-closed interval (right): %(.]%
Examples
# Closed interval
0:5 %[]% c(1,5) # logical vector
#> [1] FALSE TRUE TRUE TRUE TRUE TRUE
0:5 %[.]% c(1,5) # extract values
#> [1] 1 2 3 4 5
# Open interval
0:5 %()% c(1,5)
#> [1] FALSE FALSE TRUE TRUE TRUE FALSE
0:5 %(.)% c(1,5)
#> [1] 2 3 4
# Closed interval left
0:5 %[)% c(1,5)
#> [1] FALSE TRUE TRUE TRUE TRUE FALSE
0:5 %[.)% c(1,5)
#> [1] 1 2 3 4
# Closed interval right
0:5 %(]% c(1,5)
#> [1] FALSE FALSE TRUE TRUE TRUE TRUE
0:5 %(.]% c(1,5)
#> [1] 2 3 4 5
