Categories &

Functions List

Function Reference: rmmissing

statistics: R = rmmissing (A)

statistics: R = rmmissing (A, dim)

statistics: R = rmmissing (…, Name, Value)

statistics: [R, TF] = rmmissing (…)

Remove missing data from arrays.

Given an input vector or matrix (2-D array) A, R = rmmissing (A) returns an output vector or matrix R of the same type as input A and any missing elements removed. If A is a vector, missing elements are removed individually, if A is a matrix, then rows containing missing elements are removed.

Standard missing values and their corresponding data types are:

  • NaN - for double, single, duration, and calendarDuration arrays.
  • NaT - for datetime arrays.
  • <missing> - for string arrays.
  • <undefined> - for categorical arrays.
  • {0x0 char} - for cell arrays of character vectors.

For any data types that do not support missing values, rmmissing returns R == A and an all-false TF.

Given an input matrix (2-D array) A, R = rmmissing (A, dim) further specifies whether rows or columns containing missing data are removed from the output R based on the value of dim, which must be either 1 or 0.

  • 1: remove rows.
  • 2: remove columns.

R = rmmissing (…, Name, Value) also accepts the following paired arguments.

NameValue
'MinNumMissing'A non-negative integer scalar value specifying the required minimum number of missing values for removing any particular row or column from a matrix input, or element from a vector input (default 1). With 0, everything is removed; above 1, nothing is removed from a vector, whose elements are each missing at most once.
'MissingLocations'A logical array of the same size as input A indexing the locations of missing values in input array A. Note that specifying 'MissingLocations' overrides any standard missing values in A.

Optional return value TF is a logical array where true values represent removed entries, rows or columns from the original data A. It has one element per element of a vector, and one per row or column of a matrix, an empty A included.

See also: fillmissing, ismissing, standardizeMissing

Source Code: rmmissing