fill_linear: Fill with "linear approximation"

Description Usage Arguments Value Examples

View source: R/fill-functions.R

Description

Maturing lifecycle

Usage

1

Arguments

body

[numeric vector]

The body of the vector.

idx

[integer vector]

the index to replace with.

...

Further arguments passed to \link[stats]{approx}

Value

Returns a vector with the same class and attributes as the input vector.

Examples

1
2
3
4
5
6
7
x <- c(5,3,2,2,5)
xlen <- length(x)
n <- 2
n <- pmin(n, xlen)
idx <- 1:n
body <- x[seq_len(xlen - n)]
fill_linear(body, idx)

kvasilopoulos/transx documentation built on Jan. 26, 2021, 6:14 p.m.