View source: R/garchx-source-code.R
glag | R Documentation |
zoo
objectsSimilar to the lag
function from the stats
package, but glag
enables padding (e.g. NAs or 0s) of the lost entries. Contrary to the lag
function in the stats package, however, the default in glag
is to pad (with NA
s). The glag
is particularly suited for zoo
objects, since their indexing is retained
glag(x, k = 1, pad = TRUE, pad.value = NA)
x |
a numeric vector or matrix |
k |
integer equal to the lag (the default is 1) |
pad |
logical. If TRUE (default), then the lost entries are padded with pad.value. If FALSE, then no padding is undertaken |
pad.value |
the pad-value |
A vector or matrix with the lagged values
Empty
Genaro Sucarrat, http://www.sucarrat.net/
lag
, gdiff
, diff
##lag series with NA for the missing entries: x <- rnorm(5) glag(x) ##lag series with no padding: x <- rnorm(5) glag(x, pad=FALSE) ##lag series and retain the original zoo-index ordering: x <- as.zoo(rnorm(5)) glag(x) ##lag two periods: glag(x, k=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.