complete.cases package:stats R Documentation _F_i_n_d _C_o_m_p_l_e_t_e _C_a_s_e_s _D_e_s_c_r_i_p_t_i_o_n: Return a logical vector indicating which cases are complete, i.e., have no missing values. _U_s_a_g_e: complete.cases(...) _A_r_g_u_m_e_n_t_s: ...: a sequence of vectors, matrices and data frames. _V_a_l_u_e: A logical vector specifying which observations/rows have no missing values across the entire sequence. _S_e_e _A_l_s_o: 'is.na', 'na.omit', 'na.fail'. _E_x_a_m_p_l_e_s: x <- airquality[, -1] # x is a regression design matrix y <- airquality[, 1] # y is the corresponding response stopifnot(complete.cases(y) != is.na(y)) ok <- complete.cases(x,y) sum(!ok) # how many are not "ok" ? x <- x[ok,] y <- y[ok]