1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
\name{diff}
\alias{diff}
\alias{diff.timeSeries}
\title{Difference a 'timeSeries' object}
\description{
Difference a \code{"timeSeries"} object.
}
\usage{
\method{diff}{timeSeries}(x, lag = 1, diff = 1, trim = FALSE, pad = NA, \dots)
}
\arguments{
\item{x}{
an object of class \code{"timeSeries"}.
}
\item{lag}{
an integer indicating which lag to use.
}
\item{diff}{
an integer indicating the order of the difference.
}
\item{trim}{
a logical flag. Should \code{NA}s at the beginning of the series be
removed?
}
\item{pad}{
a numeric value with which \code{NA}s should be replaced at the
beginning of the series.
}
\item{\dots}{
currently not used.
}
}
%\details{
%}
\value{
the differenced \code{"timeSeries"} object
}
\seealso{
\code{\link[base]{diff}} for \verb{base::diff},
\code{\link{lag}}
}
\examples{
## 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)
}
\keyword{chron}
\keyword{ts}
|