Description Usage Arguments Value Examples
Search sorted data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | kd_lower_bound(x, v)
kd_upper_bound(x, v)
kd_range_query(x, l, u, ...)
## S3 method for class 'matrix'
kd_range_query(x, l, u, cols = NULL, ...)
## S3 method for class 'arrayvec'
kd_range_query(x, l, u, ...)
## S3 method for class 'data.frame'
kd_range_query(x, l, u, cols = NULL, ...)
kd_rq_indices(x, l, u, ...)
## S3 method for class 'matrix'
kd_rq_indices(x, l, u, cols = NULL, ...)
## S3 method for class 'arrayvec'
kd_rq_indices(x, l, u, ...)
## S3 method for class 'data.frame'
kd_rq_indices(x, l, u, cols = NULL, ...)
kd_binary_search(x, v)
## S3 method for class 'matrix'
kd_binary_search(x, v)
## S3 method for class 'arrayvec'
kd_binary_search(x, v)
|
x |
an object sorted by |
v |
a vector specifying where to look |
l |
lower left corner of search region |
u |
upper right corner of search region |
... |
ignored |
cols |
integer or character vector or formula indicating columns |
kd_lower_bound | a row of values (vector) |
kd_upper_bound | a row of values (vector) |
kd_range_query | a set of rows in the same format as the sorted input |
kd_rq_indices | a vector of integer indices specifying rows in the input |
kd_binary_search | a boolean |
1 2 3 4 5 6 7 8 9 10 | if (has_cxx17()) {
x = matrix(runif(200), 100)
y = matrix_to_tuples(x)
kd_sort(y, inplace = TRUE)
y[kd_lower_bound(y, c(1/2, 1/2)),]
y[kd_upper_bound(y, c(1/2, 1/2)),]
kd_binary_search(y, c(1/2, 1/2))
kd_range_query(y, c(1/3, 1/3), c(2/3, 2/3))
kd_rq_indices(y, c(1/3, 1/3), c(2/3, 2/3))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.