[R] circular filter
Christof Bigler
christof.bigler at colorado.edu
Wed Feb 25 03:47:48 CET 2004
I try to find a circular filter that I can export to be used in a
spatial software.
Assuming, we have a matrix, representing 9x9 regularly spaced points
with the center point 'filter[5, 5]'. In this example, I want to find a
function that weighs all neighbor points within a distance of d=4 units
with 1:
> filter <- matrix(0, 9, 9)
> filter <- function() ...
> filter
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 0 0 0 0 1 0 0 0 0
[2,] 0 0 1 1 1 1 1 0 0
[3,] 0 1 1 1 1 1 1 1 0
[4,] 0 1 1 1 1 1 1 1 0
[5,] 1 1 1 1 1 1 1 1 1
[6,] 0 1 1 1 1 1 1 1 0
[7,] 0 1 1 1 1 1 1 1 0
[8,] 0 0 1 1 1 1 1 0 0
[9,] 0 0 0 0 1 0 0 0 0
Finally, I want to use a larger matrix, e.g. with 61x61 points. Is
there a simple function around that I could use to this end?
Thanks!
Christof
More information about the R-help
mailing list