The R Project SVN R

Rev

Rev 27497 | Rev 30461 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27497 Rev 28166
Line 1... Line 1...
1
\name{diff}
1
\name{diff}
2
\alias{diff}
2
\alias{diff}
3
\alias{diff.default}
3
\alias{diff.default}
4
\alias{diff.POSIXt}
4
\alias{diff.POSIXt}
-
 
5
\alias{diff.Date}
5
\title{Lagged Differences}
6
\title{Lagged Differences}
6
\description{
7
\description{
7
  Returns suitably lagged and iterated differences.
8
  Returns suitably lagged and iterated differences.
8
}
9
}
9
\usage{
10
\usage{
10
diff(x, \dots)
11
diff(x, \dots)
11
 
12
 
12
\method{diff}{default}(x, lag = 1, differences = 1, \dots)
13
\method{diff}{default}(x, lag = 1, differences = 1, \dots)
13
 
14
 
14
\method{diff}{POSIXt}(x, lag = 1, differences = 1, \dots)
15
\method{diff}{POSIXt}(x, lag = 1, differences = 1, \dots)
-
 
16
 
-
 
17
\method{diff}{Date}(x, lag = 1, differences = 1, \dots)
15
}
18
}
16
\arguments{
19
\arguments{
17
  \item{x}{a numeric vector or matrix containing the values to be
20
  \item{x}{a numeric vector or matrix containing the values to be
18
    differenced.}
21
    differenced.}
19
  \item{lag}{an integer indicating which lag to use.}
22
  \item{lag}{an integer indicating which lag to use.}
20
  \item{differences}{an integer indicating the order of the difference.}
23
  \item{differences}{an integer indicating the order of the difference.}
21
  \item{\dots}{further arguments to be passed to or from methods.}
24
  \item{\dots}{further arguments to be passed to or from methods.}
22
}
25
}
23
\details{
26
\details{
24
  \code{diff} is a generic function with a default method and ones for
27
  \code{diff} is a generic function with a default method and ones for
25
  classes \code{"\link[stats]{ts}"} and \code{"\link{POSIXt}"}.
28
  classes \code{"\link[stats]{ts}"}, \code{"\link{POSIXt}"} and
-
 
29
  \code{"\link{Date}"}.
-
 
30
 
26
  \code{\link{NA}}'s propagate.
31
  \code{\link{NA}}'s propagate.
27
}
32
}
28
\value{
33
\value{
29
  If \code{x} is a vector of length \code{n} and \code{differences=1},
34
  If \code{x} is a vector of length \code{n} and \code{differences=1},
30
  then the computed result is equal to the successive differences
35
  then the computed result is equal to the successive differences