iapply               package:iterators               R Documentation

_A_r_r_a_y/_A_p_p_l_y _I_t_e_r_a_t_o_r

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

     Returns an iterator over an array. It iteratates over the array in
     much the same manner as the 'apply' function.

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

     iapply(X, MARGIN)

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

       X: the array to iterate over.

  MARGIN: a vector of subscripts. '1' indicates the first dimension
          (rows), '2' indicates the second dimension (columns), etc.

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

     The apply iterator.

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

     'apply'

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

     a <- array(1:8, c(2, 2, 2))

     # iterate over all the matrices
     it <- iapply(a, 3)
     as.list(it)

     # iterate over all the columns of all the matrices
     it <- iapply(a, c(2, 3))
     as.list(it)

     # iterate over all the rows of all the matrices
     it <- iapply(a, c(1, 3))
     as.list(it)

