na2mean {fast}R Documentation

Replace NA in a vector by mean of neighboring values.

Description

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).

Usage

na2mean(x)

Arguments

x Vector to fill

Details

The method does not work if multiple NA are in sequence.

Value

Vector with NA replaced by mean.

Author(s)

Dominik Reusser

Examples

na2mean(c(1,NA,2))
na2mean(c(1,NA,NA,2))

[Package fast version 0.51 Index]