calculates the exchange matrix between pairs of categories from a contingency table derived from the crosstabulation between a comparison variable (or variable at time *t*), and a reference variable (or variable at time *t*+1).
Exchange consists of a transition from category *i* to category *j* in some observations and a transition from category *j* to category *i* in an identical number of other observations.

1 | ```
exchangeDij(ctmatrix)
``` |

`ctmatrix` |
matrix representing a square contingency table between a comparison variable (rows) and a reference variable (columns) |

a matrix containing exchange occurring between pairs of categories from the comparison variable and the reference variable. Exchange is shown in the lower triangle of the output matrix. Output values are given in the same units as `ctmatrix`

Pontius Jr., R.G., Santacruz, A. 2014. *Quantity, exchange and shift components of difference in a square contingency table*. International Journal of Remote Sensing 35 (21), 7543-7554.

1 2 3 4 | ```
comp <- raster(system.file("external/comparison.rst", package="diffeR"))
ref <- raster(system.file("external/reference.rst", package="diffeR"))
ctmatCompRef <- crosstabm(comp, ref)
exchangeDij(ctmatCompRef)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.