The mark correlation function $\rho_f(r)$
  of a marked point process $X$
  is a measure of the dependence between the marks of two 
  points of the process a distance $r$ apart.
  It is informally defined as
  $$\rho_f(r) = \frac{E[f(M_1,M_2)]}{E[f(M,M')]}$$
  where $E[ ]$ denotes expectation and $M_1,M_2$
  are the marks attached to two points of the process
  separated by a distance $r$, while $M,M'$ are
  independent realisations of the marginal distribution of marks.  Here $f$ is any function
  $f(m_1,m_2)$
  with two arguments which are possible marks of the pattern,
  and which returns a nonnegative real value.
  Common choices of $f$ are:
  for continuous real-valued marks,
  $$f(m_1,m_2) = m_1 m_2$$
  for discrete marks (multitype point patterns),
  $$f(m_1,m_2) = 1(m_1 = m_2)$$
  and for marks taking values in $[0,2\pi)$,
  $$f(m_1,m_2) = \sin(m_1 - m_2)$$.
  
  Note that $\rho_f(r)$ is not a ``correlation''
  in the usual statistical sense. It can take any 
  nonnegative real value. The value 1 suggests ``lack of correlation'':
  if the marks attached to the points of X are independent
  and identically distributed, then
  $\rho_f(r) \equiv 1$.
  The interpretation of values larger or smaller than 1 depends
  on the choice of function $f$.
  The argument X must be a point pattern (object of class
  "ppp") or any data that are acceptable to as.ppp.
  It must be a marked point pattern.
  The argument f determines the function to be applied to
  pairs of marks. It has a sensible default, which depends on the
  kind of marks in X. If the marks
  are numeric values, then f <- function(m1, m2) { m1 * m2}
  computes the product of two marks.
  If the marks are a factor (i.e. if X is a multitype point
  pattern) then f <- function(m1, m2) { m1 == m2} yields
  the value 1 when the two marks are equal, and 0 when they are unequal.
  These are the conventional definitions for numerical
  marks and multitype points respectively.
  Alternatively the argument f may be specified by the user.
  It must be a function, accepting two arguments m1
  and m2 which are vectors of equal length containing mark
  values (of the same type as the marks of X).
  It must return a vector of numeric
  values of the same length as m1 and m2.
  The values must be non-negative, and NA values are not permitted.
  The argument r is the vector of values for the
  distance $r$ at which $\rho_f(r)$ is estimated.
  This algorithm assumes that X can be treated
  as a realisation of a stationary (spatially homogeneous) 
  random spatial point process in the plane, observed through
  a bounded window.
  The window (which is specified in X as X$window)
  may have arbitrary shape.
  Biases due to edge effects are
  treated in the same manner as in Kest.
  The edge corrections implemented here are
  [object Object],[object Object]
  Note that the estimator assumes the process is stationary (spatially
  homogeneous). 
  The numerator and denominator of the mark correlation function
  (in the expression above) are estimated using density estimation
  techniques. The user can choose between
  [object Object],[object Object],[object Object],[object Object]