shrinkVector           package:HilbertVis           R Documentation

_s_h_r_i_n_k _a _v_e_c_t_o_r _b_y _p_a_r_t_i_t_i_o_n_i_n_g _i_t _i_n_t_o _b_i_n_s _a_n_d _t_a_k_i_n_g _t_h_e _m_a_x_i_m_a _i_n
_t_h_e _b_i_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     shrinkVector(vec, newLength)

_A_r_g_u_m_e_n_t_s:

     vec: The vector to be shrunk. May be numeric or integer.

newLength: The desired size of the return vector, i.e., the number of
          partitions 

_D_e_t_a_i_l_s:

     This function is useful when plotting a very long vector such as
     those returned by 'ShortRead::pileup'. For a sufficiently long
     vector 'x',  the two commands 'plot( x, type="h" )' and '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 'plotLongVector' is a simple wrapper around
     this function.

_V_a_l_u_e:

     A vector of length 'newLength' with the maxima of each of the
     partitions of 'vector'.

_N_o_t_e:

     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.

_A_u_t_h_o_r(_s):

     Simon Anders, EMBL-EBI (sanders\@fs.tum.de)

_S_e_e _A_l_s_o:

     'plotLongVector', 'ShortRead::pileup', 
     'HilbertVisGui::simpleLinPlot'

_E_x_a_m_p_l_e_s:

        shrinkVector( 100000 + 1:1000, 17 )

