fill_na: Interpolation NA values in a vector

Description Usage Arguments Value See Also Examples

Description

This function is a tiny wrapper around approx which allows to contain the maximum number of NA values in a row that will be filled by interpolation. This is useful to obtain regular time series.

Usage

1
fill_na(x, max.len = Inf, ...)

Arguments

x

a vector, possibly containing NA values

max.len

an integer vector of length one, constraining the number of of consecutive NA observations which will get replaced with interpolated values

...

further arguments, passed on to approx.

Value

a vector

See Also

approx, na.approx

Examples

1
2
3
x <- 1:20
x[c(2, 3, 6, 11:15)] <- NA
fill_na(x, max.len = 2)


Search within the lfstat package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.