na2mean {fast} | R Documentation |
This method replaces NA-Values in a vector by the mean of the neighboring values. Example: c(1,NA,3) is converted to c(1,2,3).
na2mean(x)
x |
Vector to fill |
The method does not work if multiple NA are in sequence.
Vector with NA replaced by mean.
Dominik Reusser
na2mean(c(1,NA,2)) na2mean(c(1,NA,NA,2))