diff(base)
diff()所属R语言包:base
Lagged Differences
滞后的差异
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Returns suitably lagged and iterated differences.
返回适当的滞后和迭代的差异。
用法----------Usage----------
diff(x, ...)
## Default S3 method:[默认方法]
diff(x, lag = 1, differences = 1, ...)
## S3 method for class 'POSIXt'
diff(x, lag = 1, differences = 1, ...)
## S3 method for class 'Date'
diff(x, lag = 1, differences = 1, ...)
参数----------Arguments----------
参数:x
a numeric vector or matrix containing the values to be differenced.
一个数值向量或矩阵中的值要差。
参数:lag
an integer indicating which lag to use.
一个整数,指示哪些落后使用。
参数:differences
an integer indicating the order of the difference.
一个整数,表示顺序的差异。
参数:...
further arguments to be passed to or from methods.
进一步的参数被传递到或从方法。
Details
详情----------Details----------
diff is a generic function with a default method and ones for classes "ts", " OSIXt" and "Date".
diff是一个与默认方法的类的通用功能"ts"," OSIXt"和"Date"。
NA's propagate.
NA的传播。
值----------Value----------
If x is a vector of length n and differences=1, then the computed result is equal to the successive differences x[(1+lag):n] - x[1 n-lag)].
如果x长度n和differences=1,则计算的结果是相等的连续差异x[(1+lag):n] - x[1 n-lag)]是一个向量。
If difference is larger than one this algorithm is applied recursively to x. Note that the returned value is a vector which is shorter than x.
difference如果大于该算法递归应用到x。注意,返回值是一个向量,这是比x短。
If x is a matrix then the difference operations are carried out on each column separately.
x如果是那么差操作对每一列进行单独的矩阵。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
diff.ts, diffinv.
diff.ts,diffinv。
举例----------Examples----------
diff(1:10, 2)
diff(1:10, 2, 2)
x <- cumsum(cumsum(1:10))
diff(x, lag = 2)
diff(x, differences = 2)
diff(.leap.seconds)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|