\HeaderA{sampleStep}{Sampling of ascending numbers to ensure minimal spacing.}{sampleStep}
\keyword{manip}{sampleStep}
\begin{Description}\relax
Given a vector of ascending numbers and a step width, sample the
numbers such that the difference between consecutive numbers is greater
than or equal to \code{step}.
\end{Description}
\begin{Usage}
\begin{verbatim}
sampleStep(x, step)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Numeric or integer vector.
\item[\code{step}] Numeric scalar.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The simple algorithm works greedily from \code{x[1]} to
\code{x[length(x)]}. First, \code{x[1]} is selected. Then, if \code{x[i]}
is selected, all numbers \code{x[j]} with \code{j>i} and
\code{x[j]-x[i]<step} are dropped. Then, \code{i} is set to the
smallest j with \code{x[j]-x[i]>=step}.
\end{Details}
\begin{Value}
A logical vector of the same length as \code{x}, representing the
selected subsample.
\end{Value}
\begin{Author}\relax
W. Huber \textless{}huber@ebi.ac.uk\textgreater{}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
 x   = sort(as.integer(runif(20)*100))
 sel = sampleStep(x, step=10)
 x
 x[sel]

\end{ExampleCode}
\end{Examples}

