movingTopNIndex#
- swordfish.function.movingTopNIndex()#
Return an array vector indicating the indices of the first top elements of X after sorted within each sliding window.
- Parameters:
X (Constant) – A numeric/temporal vector.
window (Constant) – An integer no less than 2, indicating the window size.
top (Constant) – An integer greater than 1 and no greater than window.
ascending (Constant) – A Boolean value indicating whether the data within a window is sorted in ascending order. True means ascending order and false means descending order.
fixed (Constant) – A Boolean value, indicating whether the length of each row in the output array vector is fixed to be top. The default value is false. When fixed = true, all rows are of the same length. For the first (top - 1) windows, the indices of missing elements are replaced with null values.
tiesMethod (Constant) –
A string that specifies how to select elements if there are more elements with the same value than spots available in the top N after sorting X within a sliding window. It can be:
’oldest’: select elements starting from the earliest entry into the window;
’latest’: select elements starting from the latest entry into the window.