r - remove row with nan value -


let's say, example, have data:

data <- c(1,2,3,4,5,6,nan,5,9,nan,23,9) attr(data,"dim") <- c(6,2) data       [,1] [,2] [1,]    1  nan [2,]    2    5 [3,]    3    9 [4,]    4  nan [5,]    5   23 [6,]    6    9 

now want remove rows nan values in it: row 1 , 4. don't know these rows are, if it's dataset of 100.000+ rows, need find them function , remove complete row.

can point me in right direction?

the function complete.cases tell rows need:

data <- matrix(c(1,2,3,4,5,6,nan,5,9,nan,23,9), ncol=2) data[complete.cases(data), ]       [,1] [,2] [1,]    2    5 [2,]    3    9 [3,]    5   23 [4,]    6    9 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -