An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20090925/2d83cfa4/attachment.pl>
nearest neighbours
3 messages · Kátia Emidio, Kingsford Jones
Hi Katia --
Are you looking for something like this?:
library(spatstat)
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
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