tmmax
Syntax
tmmax(T, X, window)
Please see Time-Based Moving Functions (tm-functions) for the parameters and windowing logic.
Details
Calculate the moving maximum of X in a sliding window.
Examples
$ T = 1 1 1 2 5 6
$ X = 1 4 NULL -1 NULL 4
$ m = table(T as t,X as x)
$ select *, tmmax(t, x, 3) from m
t |
x |
tmmax_t |
---|---|---|
1 |
1 |
1 |
1 |
4 |
4 |
1 |
4 |
|
2 |
-1 |
4 |
5 |
||
6 |
4 |
4 |
$ T = 2021.01.02 2021.01.02 2021.01.04 2021.01.05 2021.01.07 2021.01.08
$ X = NULL 4 NULL -1 2 4
$ m = table(T as t,X as x)
$ select *, tmmax(t, x, 3d) from m
t |
x |
tmmax_t |
---|---|---|
2021.01.02 |
||
2021.01.02 |
4 |
4 |
2021.01.04 |
4 |
|
2021.01.05 |
-1 |
-1 |
2021.01.07 |
2 |
2 |
2021.01.08 |
4 |
4 |
$ select *, tmmax(t, x, 1w) from m
t |
x |
tmmax_t |
---|---|---|
2021.01.02 |
||
2021.01.02 |
4 |
4 |
2021.01.04 |
4 |
|
2021.01.05 |
-1 |
4 |
2021.01.07 |
2 |
4 |
2021.01.08 |
4 |
4 |