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]

