[R] circular filter

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Feb 25 08:49:05 CET 2004


Christof Bigler wrote:
> 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?

I don't know whether there is a function makeYourFilter(), but I'm 
pretty sure it's easy to write it. Unfortunately, I don't know which 
distance you are talking about.

Uwe Ligges



> Thanks!
> Christof
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list