Descriptive Statistic & Basic Maths functions
ASTREAK
Reference
» Reference, Discussion, & Example Applications:
About
Largest consecutive distribution of a given value, BYROW or BYCOL.
Inputs:
- a : array
- v : value
- [o] : orientation: if omitted or 0, byrow (clm vector result); if 1 , bycol (row vector result)
- [m] : max argument: if omitted => entire vector; if 1 max (of result vector)
Code
M.S. Excel
ASTREAK = LAMBDA(a, v, [o], [m],
LET(
b, IF(a = v, 1, 0),
s, LAMBDA(x,
MAX(SCAN(0, x, LAMBDA(v, i, IF(i, v + i, 0))))
),
i, IF(
o,
BYCOL(b, LAMBDA(x, s(x))),
BYROW(b, LAMBDA(x, s(x)))
),
IF(m, MAX(i), i)
)
);
Feedback
Submit and view feedback