between | R Documentation |
Are values within a certain interval?
Basically a wrapper for x >= a & x <= b
to save repeating long x names twice.
between(x, a, b = a, incl = TRUE, aincl = incl, bincl = incl, quiet = FALSE)
x |
Numerical vector |
a , b |
Numerical values/vectors specifying the borders of the interval.
|
incl |
Logical. Include values on the borders? For x == border, TRUE
will be returned. Specify per left and right border separately
with the arguments |
aincl , bincl |
Logical. Include values on left and right border, respectively?
DEFAULT: |
quiet |
Logical. Suppress warning if a>b? DEFAULT: FALSE |
Logical (boolean) vector with TRUE/FALSE values
Berry Boessenkool, berry-b@gmx.de, Aug 2017
findInterval
between(1:10, 4, 8)
between(1:10, 4:8) # range as vector
between(1:10, 8, 4) # warns about interval
data.frame( incl.T=between(1:10, 4, 8),
incl.F=between(1:10, 4, 8, incl=FALSE),
aincl.F=between(1:10, 4, 8, aincl=FALSE),
bincl.F=between(1:10, 4, 8, bincl=FALSE) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.