FAQ
Dear all,

I have SpatialPointsDataFrame type data, with a few hundred observations scattered around the globe, and am trying to identify points that are both (a) neighbours, and (b) of the same group. In other words, within a group, there may be geographically non-contiguous clusters, and geographically contiguous clusters may contain one or more groups.

Here is a simple example to illustrate what I mean:

require(sp)
set.seed(1)
g <- SpatialPointsDataFrame(coords=expand.grid(x = 1:10, y = 1:10), dataÚta.frame(group=rep(LETTERS[10:1], each)))
g <- g[sample(1:100, size0),]
plot(g, axes=T, pch=as.character(g$group))

I want to identify clusters of the *same* letter, where clusters are defined by *contiguity*.

I realise the following will get me a neighbours list:

dnearneigh(g, d1=0, d2=sqrt(2))

However, it's not clear to me how I might move from knowing about the properties of an individual point, to knowing about the identities of clusters containing variable numbers of points. And I have the added compication of wanting to parse out only neighbours that belong to the same group. Any assistance would be very much appreciated.

Thanks,
Malcolm

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupr-sig-geo @
categoriesr
postedDec 19, '10 at 2:06p
activeDec 19, '10 at 6:46p
posts2
users2
websiter-project.org
irc#r

2 users in discussion

Malcolm Fairbrother: 1 post Georg Ruß: 1 post

People

Translate

site design / logo © 2022 Grokbase