Main Content

replaceWithMissing

(Not Recommended) Insert missing data indicators into a dataset array

The dataset data type is not recommended. To work with heterogeneous data, use the MATLAB® table data type instead. See MATLAB table documentation for more information.

Description

ds2 = replaceWithMissing(ds,Name=Value) replaces specified values in a dataset array with standard missing data indicators using options specified by one or more Name=Value arguments. Use replaceWithMissing to specify:

  • Which numeric missing value indicators to replace with NaN.

  • Which character missing value indicators to replace with ''.

  • Which categorical levels to replace with <undefined>.

Input Arguments

collapse all

Dataset array, specified as a dataset object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: ds = replaceWithMissing(ds,NumericValues=99,Strings='.');

Numeric values to replace with NaN, specified as a numeric vector.

Names of categorical levels to replace with <undefined>, specified as a character vector or cell array of character vectors.

Text to replace with '', specified as a character vector or cell array of character vectors.

Set of variables in ds for which to replace missing values, specified as a positive integer or vector of positive integers indicating the variable column numbers, a variable name or a cell array of variables names, or a logical vector.

Output Arguments

collapse all

Dataset array with missing value indicators in the specified variables of ds, replaced with standard missing value indicators, returned as a dataset object.

Version History

Introduced in R2012b

See Also

|