[R] apply diff type function to matrix

message letter at openmailbox.org
Thu Jun 19 15:41:50 CEST 2014


Readers,

For a matrix:
1 10 20 30
2 15 40 60
3 20 80 120

Using a spreadsheet, a differential function can be applied to the data 
as a formula:
|(10-15)/(1-2)| ... repeated for each pair of adjacent values
What is the corresponding function in R please?
Is it better to write a new function, or to use some form of function 
'diff'?



More information about the R-help mailing list