This algorithm visits each point in the point pattern X,
inspects all the neighbouring points within a radius R of the current
point, and compiles a frequency table of the marks attached to the
neighbours. The dataset X must be a multitype point pattern, that is,
marks(X) must be a factor.
The result is a two-dimensional contingency table with one row for
each point in the pattern, and one column for each possible mark
value. The [i,j] entry in the table gives the number of
neighbours of point i that have mark j.
To perform more complicated calculations on the neighbours of every
point, use markstat or applynbd.