diff | R Documentation |
Difference a "timeSeries"
object.
## S3 method for class 'timeSeries'
diff(x, lag = 1, diff = 1, trim = FALSE, pad = NA, ...)
x |
an object of class |
lag |
an integer indicating which lag to use. |
diff |
an integer indicating the order of the difference. |
trim |
a logical flag. Should |
pad |
a numeric value with which |
... |
currently not used. |
the differenced "timeSeries"
object
diff
for base::diff
,
lag
## load Microsoft dataset
x <- MSFT[1:12, ]
x
## compute differences
diff(x)
## trimmed differences
diff(x, trim = TRUE)
## padded differences
diff(x, trim = FALSE, pad = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.