diffFill | R Documentation |
An extension on 'diff' from base R that fills blank space with NA
diffFill(x, lag = 1, differences = 1, name = NULL, ...)
x |
a numeric vector OR matrix containing the values to be differenced |
lag |
(Optional) an integer indicating which lag to use. If 'x' is a vector, 'lag' can also be a vector. Defaults to 1 |
differences |
(Optional) an integer indicating the order of the difference. If 'x' is a vector, 'differences' can also be a vector. Defaults to 1 |
name |
(Optional) A name to be used in the lagged data.frame. Defaults to the name of the variable passed to 'x'. If that is not possible, 'name' will default to "X". |
... |
(Optional) further arguments to be passed to or from methods |
Returns a vector of the same length as the input, otherwise behaves
the same as diff
. If the input is a matrix, it returns
a matrix.
# Creating dummy data # for 1 lag and 2 differences diffFill(rnorm(10), 1, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.