milastNot

Syntax

milastNot(X, window, [minPeriods])

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

Details

Return the index of the last 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
$ milastNot(v, 3)
[,,2,2,2,2,1,2,2,2,2,2,1]

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

col1

col2

col3

col4

1

1

1

1

1

0

0

1

0

1

-1

1

Related function: mifirstNot