\HeaderA{shrinkVector}{shrink a vector by partitioning it into bins and taking the maxima in
the bins}{shrinkVector}
\begin{Description}\relax
Given a (potentially very long) vector, the vector is partitioned into a given 
number of (up to rounding errors) equally long parts, and a vector of the 
maxima within each of the parts it returned.
\end{Description}
\begin{Usage}
\begin{verbatim}
shrinkVector(vec, newLength)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{vec}] The vector to be shrunk. May be numeric or integer.
\item[\code{newLength}] The desired size of the return vector, i.e., the number of
partitions 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function is useful when plotting a very long vector such as those
returned by \code{ShortRead::pileup}. For a sufficiently long vector \code{x}, 
the two commands \code{plot( x, type="h" )} and \code{plot( shrinkVector( x,
   10000 ), type="h" )} produce essential the same plot (up to a rescaling of
the x axis) but the former takes much longer to execute because R plots many
needles on top of each other. The function \code{\LinkA{plotLongVector}{plotLongVector}} is
a simple wrapper around this function.
\end{Details}
\begin{Value}
A vector of length \code{newLength} with the maxima of each of the partitions
of \code{vector}.
\end{Value}
\begin{Note}\relax
Note that, as the maximum is returned, the result may mot be what you want if
negative numbers are present. Note further that NAs may not be handles
correctly.
\end{Note}
\begin{Author}\relax
Simon Anders, EMBL-EBI (sanders\@fs.tum.de)
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{plotLongVector}{plotLongVector}},
\code{\LinkA{ShortRead::pileup}{ShortRead::pileup}}, 
\code{\LinkA{HilbertVisGui::simpleLinPlot}{HilbertVisGui::simpleLinPlot}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   shrinkVector( 100000 + 1:1000, 17 )
\end{ExampleCode}
\end{Examples}

