impute.linear: impute missing entries by linear interpolation
Description
This function imputes missing entries in a numeric vector by linear
interpolation.
Usage
impute.linear(x)
Value
a new numeric vector, with the same size of the
original vector, while all the missing entries have been imputed.
Arguments
x
a numeric data vector, where \(NA\) indicates missing
entries. The vector should contain at least two non-missing values.
Author
Yong He, Xinbing Kong, Lorenzo Trapani, Long Yu
Details
A missing entry will be imputed by linear interpolation with the two nearest
values before and after it in the vector. When all the values before (after)
it are missing, use the two nearest values after (before) it, instead.