Posting an example data structure would be helpful. As previous
people have mentioned most functions in R handle missing data by
automatically dropping it. In general, your first stop for this type
of question (data manipulation) should be the R help listserv - you
can easily access it by writing "R Cran" and then key words into
google.
Below is a link discussing this very problem (I think their solution
is a little cumbersome):
https://stat.ethz.ch/pipermail/r-help/2003-October/040997.html (just
click the link to see the text and click next message to view
responses)
#Here are my suggestions:
####create a matrix
X<-matrix(rpois(20,1.5), nrow=4)
#insert a NaN value
X[2,2]<-NaN
X
####Select all rows which do not contain an NaN value
# Least favorite
Y<-na.omit(X)
# Works but is a bit clunky
Y<-subset(X,complete.cases(X))
# I like using matrix indexing and I think this is the simplest way to
do this...
Y<-X[complete.cases(X) , ]
#mostly because if you want to switch to omitting columns you simply
move the comma.
Y<-X[ , complete.cases(X)]
-Thomas