search_bin | R Documentation |
Finds the index of the bin a number belongs to.
search_bin(arr, x)
arr |
A vector of size at least 2. |
x |
A number. Must be within the range of [ |
Finds the smallest index i
such that arr[i] <= x <= arr[i+1]
. Calls binarySearch_bin()
if length(arr) > 8
and calls naiveSearch_bin()
otherwise.
The index i
such that arr[i] <= x <= arr[i+1]
.
search_bin(1:10, seq(1, 10, by=0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.