Learn R Programming

genscore (version 1.0.0)

naiveSearch_bin: Finds the index of the bin a number belongs to using naive search.

Description

Finds the index of the bin a number belongs to using naive search.

Usage

naiveSearch_bin(arr, x)

Arguments

arr

A vector of size at least 2.

x

A number. Must be within the range of [arr[1], arr[length(arr)]].

Value

The index i such that arr[i] <= x <= arr[i+1].

Details

Finds the smallest index i such that arr[i] <= x <= arr[i+1].

Examples

Run this code
# NOT RUN {
naiveSearch_bin(1:10, seq(1, 10, by=0.5))
# }

Run the code above in your browser using DataLab