Summarise Marks in Every Neighbourhood in a Point Pattern
Visit each point in a point pattern, find the neighbouring points, and summarise their marks
markstat(X, fun, N=NULL, R=NULL, ...)
X |
A marked point pattern.
An object of class |
fun |
Function to be applied to the vector of marks. |
N |
Integer. If this argument is present,
the neighbourhood of a point of |
R |
Nonnegative numeric value. If this argument is present,
the neighbourhood of a point of |
... |
extra arguments passed to the function |
This algorithm visits each point in the point pattern X
,
determines which points of X
are “neighbours” of the current
point, extracts the marks of these neighbouring points,
applies the function fun
to the marks,
and collects the value or values returned by fun
.
The definition of “neighbours” depends on the arguments
N
and R
, exactly one of which must be given.
If N
is given, then the neighbours of the current
point are the N
points of X
which are closest to
the current point (including the current point itself).
If R
is given, then the neighbourhood of the current point
consists of all points of X
which lie closer than a distance R
from the current point.
Each point of X
is visited; the neighbourhood
of the current point is determined; the marks of these points
are extracted as a vector v
; then the function
fun
is called as:
fun(v, ...)
where ...
are the arguments passed from the call to
markstat
.
The results of each call to fun
are collected and returned
according to the usual rules for apply
and its
relatives. See the section on Value.
Similar to the result of apply
.
if each call to fun
returns a single numeric value,
the result is a vector of dimension npoints(X)
, the number of points
in X
.
If each call to fun
returns a vector of the same length
m
, then the result is a matrix of dimensions c(m,n)
;
note the transposition of the indices, as usual for the family of
apply
functions.
If the calls to fun
return vectors of different lengths,
the result is a list of length npoints(X)
.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.
trees <- longleaf # average diameter of 5 closest neighbours of each tree md <- markstat(trees, mean, N=5) # range of diameters of trees within 10 metre radius rd <- markstat(trees, range, R=10)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.