COUNTN
(x <, method> ) ;
The COUNTN function counts the number of nonmissing values in a matrix. The arguments are as follows:
specifies an numerical or character matrix. The COUNTN function counts the number of nonmissing values in this matrix.
specifies the method used to count the nonmissing values. This argument is optional. The following are valid values:
specifies that all nonmissing values are counted. This is the default value. The function returns a matrix.
specifies that the function return an matrix whose th element is the number of nonmissing values in the th row of x.
specifies that the function return a matrix whose th element is the number of nonmissing values in the th row of x.
The method argument is not case-sensitive. The first three characters are used to determine the value.
For example, the following statements count nonmissing values for a matrix x
:
x = {1 2 3, . 0 2, 1 . ., 1 0 . }; totalN = countn(x); rowN = countn(x, "ROW"); colN = countn(x, "COL"); print totalN, rowN, colN;
Figure 23.72: Counts of Nonmissing Values
totalN |
---|
8 |
rowN |
---|
3 |
2 |
1 |
2 |
colN | ||
---|---|---|
3 | 3 | 2 |