AsIs                  package:base                  R Documentation

_I_n_h_i_b_i_t _I_n_t_e_r_p_r_e_t_a_t_i_o_n/_C_o_n_v_e_r_s_i_o_n _o_f _O_b_j_e_c_t_s

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

     Change the class of an object to indicate that it should be
     treated 'as is'.

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

     I(x)

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

       x: an object

_D_e_t_a_i_l_s:

     Function 'I' has two main uses.

        *  In function 'data.frame'.  Protecting an object by enclosing
           it in 'I()' in a call to 'data.frame' inhibits the
           conversion of character vectors to factors and the dropping
           of names, and ensures that matrices are inserted as single
           columns. 'I' can also be used to protect objects which are
           to be added to a data frame, or converted to a data frame
           _via_ 'as.data.frame'.

           It achieves this by prepending the class '"AsIs"' to the
           object's classes.  Class '"AsIs"' has a few of its own
           methods, including for '[', 'as.data.frame', 'print' and
           'format'.

        *  In function 'formula'.  There it is used to inhibit the
           interpretation of  operators such as '"+"', '"-"', '"*"' and
           '"^"' as formula operators, so they are used as arithmetical
           operators.  This is interpreted as a symbol by
           'terms.formula'.

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

     A copy of the object with class '"AsIs"' prepended to the
     class(es).

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M. (1992) _Linear models._ Chapter 4 of _Statistical
     Models in S_ eds J. M. Chambers and T. J. Hastie, Wadsworth &
     Brooks/Cole.

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

     'data.frame', 'formula'

