[R-sig-Geo] Spatial indexing of a point pattern
r.turner at auckland.ac.nz
Thu Jan 17 00:04:47 CET 2013
If you are analysing point pattern data, you should probably be using
Here is a toy example of how you might determine the index of the quadrat
in which each of the points of your pattern lie:
# Simulate a pattern
X <- rpoispp(100) # By default the observation window is the unit square.
# Create quadrats
Q <- quadrats(X,nx=4)
# Cut X by Q
XQ <- cut(X,z=Q)
# Look at which quadrat the points fall into:
# If you want the *number* of each quadrat:
n <- factor(marks(XQ),labels=1:16)
# Plot the quadrat numbers:
# If you want to number along columns rather than along rows:
tQ <- tiles(Q)
tQ2 <- tQ[matrix(1:16,4,4,byrow=TRUE)] # Reordering the quadrats.
Q2 <- tess(tiles=tQ2)
XQ2 <- cut(X,z=Q2)
n2 <- factor(marks(XQ2),labels=1:16)
# Plot the quadrat numbers with the new ordering:
On 01/17/2013 02:40 AM, Aurelie C.Godin wrote:
> I have a point pattern and a tessellation (grid). Is there a way to
> spatially index each of my points? In other words, my tessellation grid has
> /n/ quadrats, I would like to know for each of my points which of these
> /(1:n)/ quadrats they are associated with.
> If not, is there another way to do so?
> Many thanks for your suggestions!
More information about the R-sig-Geo