\Header{Kfn}{Compute K-fn of a Point Pattern}
\keyword{spatial}{Kfn}
\begin{Description}\relax
Actually computes L = sqrt(K/pi).
\end{Description}
\begin{Usage}
\begin{verbatim}
Kfn(pp, fs, k=100)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{pp}] a list such as a pp object, including components \code{x} and \code{y}

\item[\code{fs}] full scale of the plot

\item[\code{k}] number of regularly spaced distances in (0, \code{fs})

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
relies on the domain D having been set by \code{ppinit} or \code{ppregion}.
\end{Details}
\begin{Value}
A list with components

\begin{ldescription}
\item[\code{x}] vector of distances

\item[\code{y}] vector of L-fn values

\item[\code{k}] number of distances returned -- may be less than \code{k} if \code{fs} is too large

\item[\code{dmin}] minimum distance between pair of points

\item[\code{lm}] maximum deviation from L(t) = t

\end{ldescription}
\end{Value}
\begin{References}\relax
Ripley, B. D. (1981) \emph{Spatial Statistics.} Wiley.

Venables, W. N. and Ripley, B. D. (2002)
\emph{Modern Applied Statistics with S.} Fourth edition.  Springer.
\end{References}
\begin{SeeAlso}\relax
\code{\Link{ppinit}}, \code{\Link{ppregion}}, \code{\Link{Kaver}}, \code{\Link{Kenvl}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
towns <- ppinit("towns.dat")
par(pty="s")
plot(Kfn(towns, 10), type="s", xlab="distance", ylab="L(t)")
\end{ExampleCode}
\end{Examples}

