DeleteMissing

DeleteMissing[list]

drops elements with head Missing from a list.

DeleteMissing[assoc]

drops elements whose values have head Missing from the association assoc.

DeleteMissing[expr,n]

applies DeleteMissing to any lists or associations that occur within the first n levels of expr.

DeleteMissing[expr,n,d]

considers an element at level n to be missing if Missing occurs within the first d levels of the element.

Details

Examples

open allclose all

Basic Examples  (2)

Delete missing elements in a list:

Delete missing values from an association:

Scope  (3)

Delete elements with head Missing up to level 2:

Delete missing elements at all levels:

Delete elements at level 1 if they contain an element with head Missing:

Delete elements at level 1 if they contain a missing expression anywhere inside:

DeleteMissing deletes complete rules when the right-hand side is Missing:

Properties & Relations  (2)

DeleteMissing[expr] deletes missing elements at the top level only:

DeleteMissing[list] is effectively equivalent to DeleteCases[list,_Missing]:

Possible Issues  (1)

DeleteMissing does not enter heads other than List or Association:

Introduced in 2014
 (10.0)
 |
Updated in 2015
 (10.1)