Fill with "linear approximation"
fill_linear(body, idx, ...)
body |
The body of the vector. |
---|---|
idx |
the index to replace with. |
... | Further arguments passed to |
Returns a vector with the same class and attributes as the input vector.
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)#> [1] 5 5