asof

Syntax

asof(X, Y)

Arguments

X must be a vector/indexed series/indexed matrix sorted in ascending order.

Y is a scalar/vector/tuple/matrix/dictionary/table/array vector.

Details

For each element y in Y, return the index of the last element in X that is no greater than y. If nothing is found, return -1.

Examples

asof(1..100, 60 200 -10)
// output
[59,99,-1]

0 0 0 1 1 1 1 2 2 3 asof 1
// output
6