fill_both: Fill with 'locf' and 'nocb'

Description Usage Arguments Value Examples

View source: R/fill-functions.R

Description

Maturing lifecycle

Usage

1
fill_both(body, idx, first = c("locf", "nocb"))

Arguments

body

[numeric vector]

The body of the vector.

idx

[integer vector]

the index to replace with.

first

[character: "locf"]

Select which filling algorithms will occur first "locf" or "nocb".

Value

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

Examples

1
2
3
4
5
6
7
8
9
leadx(1:4, fill = fill_both)
leadx(1:4, fill = ~ fill_both(.x,.y, first = "nocb"))

lagx(1:4, fill = fill_both)
lagx(1:4, fill = ~ fill_both(.x,.y, first = "nocb"))

set.seed(123)
x <- rnorm(10)
smooth_ma(x, 4, fill = fill_both)

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