linterp: Linearly interpolate missing values in a numeric vector

Description Usage Arguments Details Value

View source: R/linterp.R

Description

This value fills in missing values (NAs) in a numeric vector by linear interpolation

Usage

1
linterp(x, max_allow = 3)

Arguments

x

The numeric vector to interpolate. The first and last element must not be NA, otherwise an error is generated.

max_allow

Maximum number of consecutive missing values to allow. If there is any number of consecutive NA values in x longer than max_allow, the function will fail with an error. Set to NULL to fully disable this check.

Details

This function can be handy when running fitFluMoDL, for example to fill in small gaps in the temperatures vector. But it can be more generally useful as well.

Value

The numeric vector x, with any missing values replaced by linear interpolants.


FluMoDL documentation built on Sept. 13, 2019, 5:10 p.m.