| difflong | R Documentation |
Calculate the lagged difference of a long vector.
difflong(x, drop = TRUE)
x |
Numeric or integer vector. |
drop |
Logical value. See Details. |
A ‘long vector’ is a vector with more than
2^31 - 1 elements (the largest possible 32-bit integer).
Long vectors are supported in R on 64-bit computer systems.
This feature was introduced in R version 3.0.0.
Although long vectors are permitted, not all functions in R have been extended to handle long vectors.
The base R function diff currently does not handle
a long vector, and may cause the entire R
session to be terminated.
The function difflong is a temporary replacement
for diff in the simplest case:
difflong(x) is a replacement for diff(x).
If drop=TRUE (the default),
the result of difflong(x) is equivalent to diff(x),
a vector with length equal to length(x) - 1.
If drop=FALSE the result of difflong(x, FALSE) has the
same length as x; the first entry is zero, and the subsequent
entries are equivalent to diff(x).
A vector of the same type as x.
.
diff
x <- sample(1:5)
diff(x)
difflong(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.