RepeatBefore: RepeatBefore

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/aveytoolkit_RepeatBefore.R

Description

Replaces NAs with the latest non-NA value

Usage

1

Arguments

x

a vector of values

Details

NA values will be replaced by the most recent value with a lower index. If there is no non-NA value before the NA appears, it will remain NA.

Value

a vector of values

Author(s)

Ruben

References

http://stackoverflow.com/questions/7735647/replacing-nas-with-latest-non-na-value

See Also

rep

Examples

1
2
3
x = c(NA,NA,'a',NA,NA,NA,NA,NA,NA,NA,NA,'b','c','d',NA,NA,NA,NA,NA,'e')
newX <- RepeatBefore(x)
show(newX)

stefanavey/aveytoolkit documentation built on March 5, 2020, 12:49 a.m.