
First Differences
diffs.RdThis function is the opposite of cumsum which returns the first order differences between vector elements. An extension of diff, also including the first element of the vector.
Examples
diffs(c(1,5,7))
#> [1] 1 4 2

diffs.RdThis function is the opposite of cumsum which returns the first order differences between vector elements. An extension of diff, also including the first element of the vector.
diffs(c(1,5,7))
#> [1] 1 4 2