diff_fill: An alternative version of diff() returning vector of the same...

Description Usage Arguments Value Examples

View source: R/transform.R

Description

Wrapper to diff() function that fills in user-defined values (e.g. NA) at the beginning of the resulting vector

Usage

1
diff_fill(x, lag = 1L, differences = 1L, fill = NA)

Arguments

x

numeric/integer vector (see help for diff())

lag

(see help for diff())

differences

(see help for diff())

fill

value to fill in missing values

Value

vector of the same length and as x

Examples

1
2
3
str(diff(1:10))
str(diff_fill(1:10))
str(diff_fill(1:10, fill = NULL))

vh-d/VHtools documentation built on May 3, 2019, 6:11 p.m.