[R-sig-eco] nearest neighbours

Kingsford Jones kingsfordjones at gmail.com
Fri Sep 25 20:14:10 CEST 2009


On Fri, Sep 25, 2009 at 12:07 PM, Kingsford Jones
<kingsfordjones at gmail.com> wrote:

> library(spatstat)
> data amacrine

of course the above should have been
data(amacrine)

> out <- vector(length = 5, mode = 'list')
> for (k in 1:5) out[[k]] <- nnwhich(amacrine, k = k)
> names(out) <- paste('k =', 1:5)
> str(out)
> # List of 5
> #  $ k = 1: int [1:294] 153 1 161 161 160 154 155 9 8 11 ...
> #  $ k = 2: int [1:294] 2 154 12 153 14 7 6 167 156 156 ...
> #  $ k = 3: int [1:294] 4 6 159 3 159 3 156 155 167 157 ...
> #  $ k = 4: int [1:294] 161 153 4 160 162 2 154 156 169 158 ...
> #  $ k = 5: int [1:294] 154 4 154 2 161 155 10 7 157 7 ...
>
> If you wanted to do this within marks you could subset by mark first
> -- see ?split.ppp.
>
> You might also find the following search useful:
> help.search('nearest', package = 'spatstat')
>
>
> hth,
>
> Kingsford Jones
>
>
>
> On Fri, Sep 25, 2009 at 9:31 AM, Kátia Emidio <kat.emidio at gmail.com> wrote:
>> Hi, What function should I use to find out who are my 5 nearest neigbours(N)
>> or in a specified radius,  in a .ppp (object) where the marks are factors?
>> thanks
>> Katia
>>
>> --
>> Kátia Emídio da Silva MSc
>> Eng. Florestal
>> Pesquisador
>> Embrapa Amazônia Ocidental
>>
>>        [[alternative HTML version deleted]]
>>
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>>
>



More information about the R-sig-ecology mailing list