[R-sig-Geo] extract matrix values using circular window

Lorenzo Cattarino l.cattarino at uq.edu.au
Fri Mar 16 07:48:46 CET 2012


I wanna know how many cells with values of one (1) are within a circular neighbourhood with radius r and centre in x0 y0.

-----Original Message-----
From: Rolf Turner [mailto:r.turner at auckland.ac.nz] 
Sent: Friday, 16 March 2012 4:45 PM
To: Lorenzo Cattarino
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] extract matrix values using circular window

On 16/03/12 17:23, Lorenzo Cattarino wrote:
> Hi,
>
> I am trying to extract the values of the following matrix
>
> my.mat<- matrix(sample(c(1,0),100,replace=T),ncol=10)
>
> using a circular window/mask. I would like to be able to choose coordinates of window centre and circle radius. I looked into the raster and spatstat packages, and specifically the function disc(), but I could not get them to work properly.
>
> Any help is really appreciated.

Your question makes no sense at all to me.   WTF  has your 10 x 10 matrix of
random zeroes and ones got to do with a circular window?

If you could actually explain what you are trying to do, I could probably tell you how to do it.

     cheers,

         Rolf Turner



More information about the R-sig-Geo mailing list