next
Syntax
next(X)
Details
Shift the elements of a vector to the left for one position. In comparison, prev shifts the elements of a vector to the right for one position; move shifts the elements of a vector for multiple positions.
In Python, the next function retrieves the next element from an
iterator. In contrast, next(X) in DolphinDB is equivalent to
shift(X, -1) in Python.
Parameters
X is a vector/matrix/table.
Returns
An object with the same data type and form as X.
Examples
x = 1..5;
next(x);
// output: [2,3,4,5,]
x = matrix(1 2 3 4 5);
next(x)
| #0 |
|---|
| 2 |
| 3 |
| 4 |
| 5 |
t=table(1 2 3 as a, `x`y`z as b, 10.8 7.6 3.5 as c);
next(t)
| a | b | c |
|---|---|---|
| 2 | y | 7.6 |
| 3 | z | 3.5 |
