View source: R/keep_in_bounds.R
keep_in_bounds | R Documentation |
Filters vector x
to only keep elements which are in bounds [lower, upper]
.
This is equivalent to the following, but tries to avoid unnecessary allocations:
x[!is.na(x) & x >= lower & x <= upper]
Currently only works for integer x
.
keep_in_bounds(x, lower, upper)
x |
( |
lower |
( |
upper |
( |
(integer()) with only values in [lower, upper]
.
keep_in_bounds(sample(20), 5, 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.