Description Usage Arguments Value Author(s) See Also Examples
Compute the difference of values in vector
1 | get_diff(x)
|
x |
|
numeric
vector
Thomas P. Harte
1 2 3 4 5 6 7 8 9 10 11 12 | get_diff(c(NA))
get_diff(c(NA, NA))
get_diff(c(NaN, NA))
get_diff(c(NaN, 1, 1.1))
get_diff(c(1, +Inf, 1.1))
dates<- seq(as.Date("2011-01-01"), by=1, len=6)
z<- zoo(c(NA, 1, 2, 3, 0, 0), order.by=dates)
zoo::rollapply(z, 2, get_diff, align="right")
# 2011-01-02 2011-01-03 2011-01-04 2011-01-05 2011-01-06
# NA 1.0 1.0 -3.0 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.