extrapolateNA: Extrapolate NA's in a univariate vector

Description Usage Arguments Value Examples

View source: R/valuefunctions.R

Description

Extrapolates NA's in the beginning or the end of a univariate vector. Intermediate NA's that occur between two observed values are not touched. Please use interpolation for that case.

Usage

1
extrapolateNA(x, len = 3)

Arguments

x

the univariate vector to extrapolate

len

the number of non NA elements to base the extrapolation on which defaults to 3

Value

a vector with the NA's in the beginning and the end extrapolated

Examples

1
2
3
extrapolateNA(c(NA, NA, NA, 4, 5, 6, 7, NA, NA))
extrapolateNA(c(0, NA, NA, 4, 5, 6, 7, NA, NA))
extrapolateNA(c(0, NA, NA, 4, 5, 6, 7, NA, 9))

DoktorMike/datools documentation built on Feb. 28, 2021, 8:39 a.m.