mifirstNot

Syntax

mifirstNot(X, window, [minPeriods])

Please see Moving Functions (m-functions) for the parameters and windowing logic.

Details

Return the index of the first non-Null element of X in a sliding window (based on the number of elements or time).

Examples

$ v = NULL NULL 2 3 4 8 NULL 5 -2 3 -1 0 NULL
$ mifirstNot(v, 3)
[,,2,1,0,0,0,0,1,0,0,0,0]

$ m = matrix(NULL 1 2 3, 1 NULL 2 3, NULL NULL 3 4, 1 2 3 4)
$ mifirstNot(m, 2)

col1

col2

col3

col4

1

0

-1

0

0

1

1

0

0

0

0

0

Related function: milastNot