isVectorAtomic           package:ifultools           R Documentation

_T_e_s_t_s _w_h_e_t_h_e_r _a_n _o_b_j_e_c_t _i_s _a _v_e_c_t_o_r _o_r _n_o_t

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

     The 'is.vector' function returns a 'FALSE' value in some cases
     where intuitively one might expect a 'TRUE' value to be returned.
     For example, 'is.vector(z)' returns 'FALSE' for each of the
     following:

     _i 'z <- 1:3;names(z) <- 1:3'

     _i_i 'z <- matrix(1:3, nrow=1)'

     _i_i_i 'z <- matrix(1:3, ncol=1)'

     These results are not necessarily incorrect, they are just one
     interpretion of the definition of a vector. Contrarily, the
     'isVectorAtomic(z)' function returns 'TRUE' for each of the above
     examples. Thus, 'isVectorAtomic' expands the basic definition of a
     vector to allow matrices containing a single row or column and
     named vectors. Also, unlike 'is.vector', 'isVectorAtomic' returns
     'FALSE' for objects of class 'list'.

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

     isVectorAtomic(x)

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

       x: an object of arbitrary class.

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

     a vector of character strings containing the result. The length of
     this vector is equal to 'length(x)'.

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

     'rotateVector', 'mergeList'.

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

     ## cases where isVectorAtomic returns TRUE 
     z <- 1:3;names(z) <- letters[1:3]
     isVectorAtomic(z)
     isVectorAtomic(matrix(1:3, nrow=1))
     isVectorAtomic(matrix(1:3, ncol=1))
     isVectorAtomic(1:5)
     isVectorAtomic(letters)

     ## cases where isVectorAtomic returns FALSE 
     isVectorAtomic(list(1:3))
     isVectorAtomic(data.frame(1:3,2:4))
     isVectorAtomic(matrix(1:12, nrow=4))

