mlast

New in version 2.00.3.

语法

mlast(X, window, [minPeriods])

参数说明和窗口计算规则请参考: 滑动窗口系列(m 系列)

详情

在给定长度(以元素个数或时间长度衡量)的滑动窗口内计算 X 的最后一个元素。

例子

$ index = second(08:20:00)+1..7
$ x = 2 1 3 NULL 6 5 4
$ x = index.indexedSeries(x)
$ mlast(x,3s)

label

col1

08:20:01

2

08:20:02

1

08:20:03

3

08:20:04

08:20:05

6

08:20:06

5

08:20:07

4

$ m = matrix(1 5 9 0 2, 9 10 2 NULL 2)
$ m.rename!((date(2020.09.08)+1..3) join 2020.09.16 join 2020.09.26, `A`B)
$ m.setIndexedMatrix!()
$ mlast(m, 3d)

label

A

B

2020.09.09

1

9

2020.09.10

5

10

2020.09.11

9

2

2020.09.16

0

2020.09.26

2

2

$ mlast(m, 1w)

label

A

B

2020.09.09

1

9

2020.09.10

5

10

2020.09.11

9

2

2020.09.16

0

2020.09.26

2

2

相关函数:last, first