type.convert              package:utils              R Documentation

_T_y_p_e _C_o_n_v_e_r_s_i_o_n _o_n _C_h_a_r_a_c_t_e_r _V_a_r_i_a_b_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Convert a character vector to logical, integer, numeric, complex
     or factor as appropriate.

_U_s_a_g_e:

     type.convert(x, na.strings = "NA", as.is = FALSE, dec = ".")

_A_r_g_u_m_e_n_t_s:

       x: a character vector.

na.strings: a vector of strings which are to be interpreted as 'NA'
          values.  Blank fields are also considered to be missing
          values in logical, integer, numeric or complex vectors.

   as.is: logical.  See 'Details'.

     dec: the character to be assumed for decimal points.

_D_e_t_a_i_l_s:

     This is principally a helper function for 'read.table'. Given a
     character vector, it attempts to convert it to logical, integer,
     numeric or complex, and failing that converts it to factor unless
     'as.is = TRUE'.  The first type that can accept all the
     non-missing values is chosen.

     Vectors which are entirely missing values are converted to
     logical, since 'NA' is primarily logical.

     Since this is a helper function, the caller should always pass an
     appropriate value of 'as.is'.

_V_a_l_u_e:

     A vector of the selected class, or a factor.

_S_e_e _A_l_s_o:

     'read.table'

