anymissing

Tests whether any element of an array is a missing value.

Category: Language Fundamentals > Data Types

Syntax

tf = anymissing(A)

Returns a single logical value: true if any element is missing.

Description

It works like any(ismissing(A), 'all') without building the intermediate array. Because it follows the type's own idea of "missing", the same call checks numeric, string and categorical data.

Input arguments

A
Array or table. What counts as missing depends on the type: NaN for numbers, <missing> for strings, <undefined> for categoricals, NaT for datetimes.

Output arguments

tf
Scalar logical.

Example

Numbers and strings

anymissing([1 NaN 3])
anymissing([1 2 3])
anymissing(["a" missing])
Output
ans = logical
   1
ans = logical
   0
ans = logical
   1

See also

ismissing anynan rmmissing fillmissing standardizeMissing