is.recursive              package:base              R Documentation

_I_s _a_n _O_b_j_e_c_t _A_t_o_m_i_c _o_r _R_e_c_u_r_s_i_v_e?

_D_e_s_c_r_i_p_t_i_o_n:

     'is.atomic' returns 'TRUE' if 'x' is an atomic vector (or 'NULL')
     and 'FALSE' otherwise.

     'is.recursive' returns 'TRUE' if 'x' has a recursive (list-like)
     structure and 'FALSE' otherwise.

_U_s_a_g_e:

     is.atomic(x)
     is.recursive(x)

_A_r_g_u_m_e_n_t_s:

       x: object to be tested.

_D_e_t_a_i_l_s:

     'is.atomic' is true for the atomic vector types ('"logical"',
     '"integer"', '"numeric"', '"complex"', '"character"' and '"raw"')
     and 'NULL'.

     Most types of language objects are regarded as recursive: those
     which are not are the atomic vector types, 'NULL' and symbols (as
     given by 'as.name').

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'is.list', 'is.language', etc, and the 'demo("is.things")'.

_E_x_a_m_p_l_e_s:

     require(stats)

     is.a.r <- function(x) c(is.atomic(x), is.recursive(x))

     is.a.r(c(a=1,b=3))      # TRUE FALSE
     is.a.r(list())          # FALSE TRUE ??
     is.a.r(list(2))         # FALSE TRUE
     is.a.r(lm)              # FALSE TRUE
     is.a.r(y ~ x)           # FALSE TRUE
     is.a.r(expression(x+1)) # FALSE TRUE (not in 0.62.3!)

