Creating a moving window average with two distance matrices
- mojodu54
- Nov 23, 2024
- 1 min read
I wrote a short function in R that combines two distance matrices (for example a floristic dissimilarity matrix and a geographical distance matrix).
The function takes the elements from the first matrix and averages all the distances according to either:
a number of neighbouring cells
an absolute distance between neighbouring cells
The result is a vector of averaged values. This can then be visualized to see how dissimilarity changes with spatial scales.
Like this

You can check it out on my github.
Comments