all-methods package:Matrix R Documentation "_M_a_t_r_i_x" _M_e_t_h_o_d_s _f_o_r _F_u_n_c_t_i_o_n_s _a_l_l() _a_n_d _a_n_y() _D_e_s_c_r_i_p_t_i_o_n: The basic R functions 'all' and 'any' now have methods for 'Matrix' objects and should behave as for 'matrix' ones. _M_e_t_h_o_d_s: _a_l_l 'signature(x = "Matrix", ..., na.rm = FALSE)': ... _a_n_y 'signature(x = "Matrix", ..., na.rm = FALSE)': ... _a_l_l 'signature(x = "ldenseMatrix", ..., na.rm = FALSE)': ... _a_l_l 'signature(x = "lsparseMatrix", ..., na.rm = FALSE)': ... _E_x_a_m_p_l_e_s: M <- Matrix(1:12 +0, 3,4) all(M >= 1) # TRUE any(M < 0 ) # FALSE MN <- M; MN[2,3] <- NA; MN all(MN >= 0) # NA any(MN < 0) # NA any(MN < 0, na.rm = TRUE) # -> FALSE