Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore
See also: tdiff

Quantlet: diff
Description: computes first differences (along the rows) of an array.

Usage: dx = diff(x)
Input:
x d1 x d2 x ... x dn array
Output:
dx (d1-1) x d2 x ... x dn array, first differences along the rows of x.

Example:
library("xplore")
x =(1:4)|6
diff(x)

Result:
Contents of dx
[1,]        1
[2,]        1
[3,]        1
[4,]        2
Example:
library("xplore")
x = matrix(3, 2, 2)
x[1, 1, 1] = 2
x[2, 2, 2] = 3
diff(x)

Result:
Contents of dx
[,,1,1,1,1,1,1]
[1,]       -1        0
[2,]        0        0
[,,2,1,1,1,1,1]
[1,]        0        2
[2,]        0       -2



Author: MD*Tech, 20021120 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006