Language Reference


COUNTMISS Function

COUNTMISS (x <, method> );

The COUNTMISS function counts the number of missing values in a matrix. The arguments are as follows:

x

specifies an $n\times p$ numerical or character matrix. The COUNTMISS function counts the number of missing values in this matrix.

method

specifies the method used to count the missing values. This argument is optional. The following are valid values:

"all"

specifies that all missing values are counted. This is the default value. The function returns a $1\times 1$ matrix.

"row"

specifies that the function return an $n\times 1$ matrix whose ith element is the number of missing values in the ith row of x.

"col"

specifies that the function return a $1\times p$ matrix whose jth element is the number of missing values in the jth 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 missing values for the matrix x:

x = {1 2 3,
     . 0 2,
     1 . .,
     1 0 . };
totalMiss = countmiss(x);
rowMiss = countmiss(x, "ROW");
colMiss = countmiss(x, "COL");
print totalMiss, rowMiss, colMiss;

Figure 24.82: Counts of Missing Values

totalMiss
4

rowMiss
0
1
2
1

colMiss
1 1 2