in_range {gggenomes} | R Documentation |
Do numeric values fall into specified ranges?
Description
Do numeric values fall into specified ranges?
Usage
in_range(x, left, right, closed = TRUE)
Arguments
x |
a numeric vector of values |
left , right |
boundary values or vectors of same length as x |
closed |
wether to include ( |
Value
a logical vector of the same length as the input
Examples
in_range(1:5, 2, 4)
in_range(1:5, 2, 4, closed = c(FALSE, TRUE)) # left-open
in_range(1:5, 6:2, 3) # vector of boundaries, single values recycle
# plays nicely with dplyr
df <- tibble::tibble(x = rep(4, 5), left = 1:5, right = 3:7)
dplyr::mutate(df,
closed = in_range(x, left, right, TRUE),
open = in_range(x, left, right, FALSE)
)
[Package gggenomes version 1.0.0 Index]