sampleStep            package:tilingArray            R Documentation

_S_a_m_p_l_i_n_g _o_f _a_s_c_e_n_d_i_n_g _n_u_m_b_e_r_s _t_o _e_n_s_u_r_e _m_i_n_i_m_a_l _s_p_a_c_i_n_g.

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

     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 'step'.

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

     sampleStep(x, step)

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

       x: Numeric or integer vector.

    step: Numeric scalar.

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

     The simple algorithm works greedily from 'x[1]' to 'x[length(x)]'.
     First, 'x[1]' is selected. Then, if 'x[i]' is selected, all
     numbers 'x[j]' with 'j>i' and 'x[j]-x[i]<step' are dropped. Then,
     'i' is set to the smallest j with 'x[j]-x[i]>=step'.

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

     A logical vector of the same length as 'x', representing the
     selected subsample.

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

     W. Huber <huber@ebi.ac.uk>

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

      x   = sort(as.integer(runif(20)*100))
      sel = sampleStep(x, step=10)
      x
      x[sel]

