vector-detect-pairwise | R Documentation |
This family of functions detects different types of relationships between a
vector and an iv pairwise. where pairwise means that the i-th value of x
is compared against the i-th value of y
. This is in contrast to
iv_between()
, which works more like base::%in%.
iv_pairwise_between()
detects if the i-th value of x
, a vector, falls
between the bounds of the i-th value of y
, an iv.
iv_pairwise_includes()
detects if the i-th value of x
, an iv, includes
the i-th value of y
, a vector.
These functions return a logical vector the same size as the common size of
x
and y
.
iv_pairwise_between(x, y) iv_pairwise_includes(x, y)
x, y |
For For
|
A logical vector the same size as the common size of x
and y
.
Locating relationships
Locating relationships between a vector and an iv
Detecting relationships between a vector and an iv
x <- as.Date(c("2019-01-01", "2019-01-08", "2019-01-21")) y <- iv_pairs( as.Date(c("2019-01-01", "2019-01-03")), as.Date(c("2019-01-07", "2019-01-09")), as.Date(c("2019-01-18", "2019-01-21")) ) x y # Does the i-th value of `x` fall between the i-th interval of `y`? iv_pairwise_between(x, y) # Does the i-th interval of `y` include the i-th value of `x`? iv_pairwise_includes(y, x) a <- c(1, NA, NA) b <- iv_pairs(c(NA, NA), c(3, 4), c(NA, NA)) # Missing intervals always propagate iv_pairwise_between(a, b) iv_pairwise_includes(b, a)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.