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

Bart bart at njn.nl
Fri Mar 16 08:14:50 CET 2012


You could have a look the buffer argument of the extract function in raster

Bart

On 03/16/2012 07:48 AM, Lorenzo Cattarino wrote:
> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list