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