idiv                package:iterators                R Documentation

_D_i_v_i_d_i_n_g _I_t_e_r_a_t_o_r

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

     Returns an iterator that returns pieces of numeric value.

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

     idiv(n, ..., chunks, chunkSize)

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

       n: number of times that the iterator will fire. If not
          specified, it will count forever.

     ...: unused.

  chunks: the number of pieces that 'n' should be divided into. This is
          useful when you know the number of pieces that you want. If
          specified, then 'chunkSize' should not be.

chunkSize: the maximum size of the pieces that 'n' should be divided
          into. This is useful when you know the size of the pieces
          that you want. If specified, then 'chunks' should not be.

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

     The dividing iterator.

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

       # divide the value 10 into 3 pieces
       it <- idiv(10, chunks=3)
       nextElem(it)
       nextElem(it)
       nextElem(it)
       try(nextElem(it))  # expect a StopIteration exception

       # divide the value 10 into pieces no larger than 3
       it <- idiv(10, chunkSize=3)
       nextElem(it)
       nextElem(it)
       nextElem(it)
       nextElem(it)
       try(nextElem(it))  # expect a StopIteration exception

