categorical

Methods

Method Reference: categorical.ismissing

categorical: out = ismissing (C)

categorical: out = ismissing (C, indicator)

Find missing elements in categorical array.

TF = ismissing (C) returns a logical array TF of the same size as C containing true for each corresponding element of C that does not have a value from one of the categories in C and false otherwise.

TF = ismissing (C, indicator) returns a logical array TF containing true for each corresponding element of C that matches a value in indicator and false otherwise. The undefined elements of C are not marked, unless indicator names them.

indicator must be a character vector, a cell vector of character vectors, a string vector, missing, or a categorical vector.

  • Character vectors are read as when constructing a categorical array: an empty or blank character vector matches the undefined elements of C, and any other matches the elements of C in the category of that name.
  • Strings match only the elements of C in the category of that name, so neither "" nor <missing> matches the undefined elements.
  • missing matches the undefined elements of C.
  • A categorical indicator matches the elements of C in each of its categories, and its undefined elements match the undefined elements of C. MATLAB accepts no categorical indicator, so this is an Octave extension.

Source Code: categorical

For a categorical array ismissing is the same test as isundefined: the missing value is the <undefined> element. It exists so categoricals plug into the generic missing-data tools (rmmissing, standardizeMissing).

 C = categorical ({'M'; ''; 'L'})
C =
  3x1 categorical array

    M              
    <undefined>    
    L
 ismissing (C)
ans =

  0
  1
  0