is.na-methods package:Matrix R Documentation _i_s._n_a() _M_e_t_h_o_d_s _f_o_r '_M_a_t_r_i_x' _O_b_j_e_c_t_s _D_e_s_c_r_i_p_t_i_o_n: Methods for function 'is.na()' for all Matrices (objects extending the 'Matrix' class): _x = "_d_e_n_s_e_M_a_t_r_i_x" returns a '"nMatrix"' object of same dimension as 'x', with TRUE's whenever 'x' was NA. _x = "_s_p_a_r_s_e_M_a_t_r_i_x" ditto. _U_s_a_g_e: ## S4 method for signature 'sparseMatrix': is.na(x) _A_r_g_u_m_e_n_t_s: x: sparse or dense matrix. _S_e_e _A_l_s_o: 'NA', 'is.na'; 'nMatrix', 'denseMatrix', 'sparseMatrix'. _E_x_a_m_p_l_e_s: M <- Matrix(1:6, nrow=4, ncol=3, dimnames = list(c("a", "b", "c", "d"), c("A", "B", "C"))) stopifnot(all(!is.na(M))) M[2:3,2] <- NA is.na(M) A <- spMatrix(10,20, i = c(1,3:8), j = c(2,9,6:10), x = 7 * (1:7)) stopifnot(all(!is.na(A))) A[2,3] <- A[1,2] <- A[5, 5:9] <- NA inA <- is.na(A) stopifnot(sum(inA) == 1+1+5)