last
Syntax
last(X)
Arguments
X is a scalar/vector/matrix.
Details
Return the last element of a vector, or the last row of a matrix.
If the last element is NULL, the function returns NULL. To get the last non-NULL element, use lastNot.
Examples
last(`hello `world);
// output
world
last(1..10);
// output
10
m = matrix(1 2 3, 4 5 6);
m;
| #0 | #1 |
|---|---|
| 1 | 4 |
| 2 | 5 |
| 3 | 6 |
last(m);
// output
[3,6]
Related function: first
