@cfirst |

First non-missing value in each column of a matrix object.

Syntax: @cfirst(m)

m: matrix

Return: vector

Returns a vector containing the first non-missing value from each column of the matrix m.

Examples

Let M1 be an lower triangular matrix whose elements above the main diagonal are NAs. In this case,

= @cfirst(m1)

returns the main diagonal of M1 as a column vector.

Cross-references