fillfun()

Read(207) Label: fill, missing value,

Description:

Fill missing values with the specified values.

Syntax:

A.fillfun(xs,tq)

Note:

The function fills missing values in vector A with member values of sequence xs according to the positions specified by sequence tq.

Generally, tq’s length should be consistent with the number of missing values in vector A and the indexes in tq should correspond to A’s missing values; if a position provided in tq does not correspond to a missing value, do not replace the existing value but keep it; if tq’s length and the number of index values cannot cover all positions of missing values in vector A, values at the positions that do not have indexes will still be nulls.

 

When xs and tq have same length, xs(i) is the to-be-filled value at the index position tq(i) and there is a one-to-one correspondence between them; when xs’s length is less than tq’s, copy the last xs member value to the rest of the positions specified in tq; when xs’s length is greater than tq’s, fill the missing values according to xs’s length and ignore the extra xs members.

Parameter:

A

A one-dimensional sequence

xs

A one-dimensional sequence whose members will fill the missing value positions

tq

A one-dimensional sequence whose members are indexes of missing value positions in sequence A

Return value:

Sequence

Example:

 

A

 

1

=[1.0,2.0,3.0,,,4.0,,,5.0,,,9.0]

2

=A1.avg()

 

3

=[4,5,7,8,10]

 

4

=A1.fillfun(A2,A3)

5

=["sss",2,,7,,90.9,"2"]

6

=[111,222,333]

 

7

=[1,2,3]

 

8

=A5.fillfun(A6,A7)