I want to take an existing MxN matrix and create a new M-1xN matrix such that for each columns, the elements are the difference between adjacent row elements of the original matrix.
The idea is the data goes from a cumulative type to a rate type...
eg: I have (where each column is a specific data series).
[,1] [,2] [,3]
[1,] "17" "16" "15"
[2,] "34" "32" "32"
[3,] "53" "47" "48"
[4,] "72" "62" "63"
[5,] "90" "78" "79"
[6,] "109" "94" "96"
I would like -
[,1] [,2] [,3]
[1,] "17" "16" "17"
[2,] "19" "15" "16"
[3,] "19" "15" "15"
[4,] "18" "16" "16"
[5,] "19" "16" "17"