between {data.table} | R Documentation |
Intended for use in data.table i clause 'where'.
between(x,lower,upper,incbounds=TRUE) x
x |
Any vector e.g. numeric, character, date, ... |
lower |
Lower range bound. |
upper |
Upper range bound. |
incbounds |
TRUE means inclusive bounds i.e. [lower,upper]. FALSE means exclusive bounds i.e. (lower,upper). |
Integer vector containing the locations of x which lie within the range [lower,upper] or (lower,upper).
Current implementation does not make use of sorted keys.
Matthew Dowle
DT = data.table(a=1:5, b=6:10) DT[b %between% c(7,9)] # select from DT where b between 7 and 9