dropna

Syntax

dropna(X, [byRow=true], [thresh])

Arguments

X is a vector or matrix.

byRow (optional) is a Boolean value. The default value is true.

thresh (optional) is a positive integer.

Details

If X is a vector, delete all NULL values from X.

If X is a matrix and byRow=true, delete all rows with NULL values.

If X is a matrix and byRow=false, delete all columns with NULL values.

If thresh is specified, each row or column (as specified by byRow) in the result must have at least thresh non-NULL values.

Examples

x=1 NULL 2 3 NULL NULL 4;
x.dropna();
// output
[1,2,3,4]

m=matrix(1 1 1 1, 1 1 1 NULL, 1 NULL 1 NULL);
m;
#0 #1 #2
1 1 1
1 1
1 1 1
1
dropna(m);
#0 #1 #2
1 1 1
1 1 1
dropna(m,,2);
#0 #1 #2
1 1 1
1 1
1 1 1
dropna(m,false);
#0
1
1
1
1
dropna(m,false,3);
#0 #1
1 1
1 1
1 1
1