find_max_ind | R Documentation |
Finds the max index in a vector that does not exceed a target number.
find_max_ind(vals, target, start = 1)
vals |
A vector of numbers. |
target |
A number. Must not be smaller than |
start |
A number, the starting index; default to 1. Must be such that |
The max index i
such that vals[i] <= target
and i >= start
.
for (i in 1:100) {
vals <- 1:i
for (start in 1:i)
for (target in seq(start, i+0.5, by=0.5))
if (find_max_ind(vals, target, start) != floor(target))
stop()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.