powered by
Difference a "timeSeries" object.
"timeSeries"
# S3 method for timeSeries diff(x, lag = 1, diff = 1, trim = FALSE, pad = NA, ...)
the differenced "timeSeries" object
an object of class "timeSeries".
an integer indicating which lag to use.
an integer indicating the order of the difference.
a logical flag. Should NAs at the beginning of the series be removed?
NA
a numeric value with which NAs should be replaced at the beginning of the series.
currently not used.
diff for base::diff, lag
diff
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)
Run the code above in your browser using DataLab