Description:
Fill missing values using the specified constant value.
Syntax:
A.fillcons(v)
Note:
The function uses constant value v to fill missing values in sequence A. A is a vector or a matrix; v can be a scalar or a vector.
If v is a single value, fill all missing values with it; if v is a vector, enter each element to the position of missing value in the corresponding column of sequence A.
v’s length should be greater than or equal to the number of columns in sequence A. For filling by column, each member of v corresponds to the missing value position in a column of A; enter the members from left to right in order and ignore the extra member(s). If v’s length is less than the number of columns in sequence A, error will be reported.
Parameter:
A |
A sequence |
v |
A constant value |
Option:
@n |
Treat non-numeric members in the sequence as nulls |
Return value:
Sequence
Example:
|
A |
|
1 |
=[1,2,,,5,,7,8] |
|
2 |
=A1.fillcons(999) |
Fill all missing values with the specified single value. |
3 |
=[1,2,,,5,,7,8] |
|
4 |
=[999,888,777,666,555,444,333,222,111] |
|
5 |
=A3.fillcons(A4) |
Fill missing values by column. |
6 |
=[[1,2,,,5,,7,8],[2,3,4,,,,5,]] |
|
7 |
=A6.fillcons(999) |
Fill all missing values with the specified single value. |
8 |
=[[1,2,,,5,,7,8],[2,3,4,,,,5,]] |
|
9 |
=[999] |
|
10 |
=A8.fillcons(A9) |
Same as A7. |
11 |
=[[1,2,,,5,,7,8],[2,3,4,,,,5,]] |
|
12 |
=A11.fillcons(A4) |
Fill missing values by column. |
13 |
=["sss",2,,7,,90.9,"2"] |
|
14 |
=A13.fillcons@n(A4) |
Treat the non-numeric member as null. |