fill_na: Fill gaps in a vector

Description Usage Arguments Value

View source: R/utils.r

Description

Fill gaps with linearization (mean of the adjacent values) or repetition of previous/next value, by using the na.approx function.

Usage

1
fill_na(x, method = c("linearize", "previous", "next"), maxgap = 2)

Arguments

x

numeric vector

method

how to fill in the gaps (default by linearization, otherwise by previous/next value duplication)

maxgap

maximum number of consecutive NAs to fill. Any longer gaps will be left unchanged.

Value

numeric vector with filled 1-value gaps


pezzacolori/boris-r-misc documentation built on Sept. 14, 2021, 1:46 a.m.