asEach            package:externalVector            R Documentation

_C_o_e_r_c_e _e_a_c_h _e_l_e_m_e_n_t _o_f _a_n _e_x_t_e_r_n_a_l _v_e_c_t_o_r _t_o _a _p_a_r_t_i_c_u_l_a_r _t_y_p_e

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

     This generic coerces each element of an external vector to a
     particular type.

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

     asEach(x, type, arrayOnly = FALSE)

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

       x: An external vector object. 

    type: Character-string, a basic vector mode. 

arrayOnly: If arrayOnly is 'FALSE' (the default) do not copy extra
          slots like 'Names', 'DimNames' or 'Dim'. 

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

     Another external vector object of same length but with
     'class(defaultElement(x)) == class(type)'.

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

     'as' to convert an object to a different class.

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

     x <- externalCharacter(4)
     x[] <- c("1", "2", "3", "4")
     asEach(x, "integer")

