seqToIntervals            package:R.utils            R Documentation

_G_e_t_s _a_l_l _c_o_n_t_i_g_o_u_s _i_n_t_e_r_v_a_l_s _o_f _a _v_e_c_t_o_r _o_f _i_n_d_i_c_e_s

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

     Gets all contigous intervals of a vector of indices.

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

     ## Default S3 method:
     seqToIntervals(idx, ...)

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

     idx: A 'vector' of 'integer' indices.

     ...: Not used.

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

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

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

       print(seqToIntervals(1:10))  # [1 10]
       print(seqToIntervals(c(1:10, 15:18, 20)))  # [1 10; 15 18; 20 20]

