Hi everyone, I have a matrix with many Na's. Some rows contain some Na's and some others are entirely composed of Na's. I want to delete the rows that are entirely composed of Na's but not the other ones so I can't use a simple removeNA. Has any one an idea? ----- Anna Lippel -- View this message in context: http://n4.nabble.com/Delete-missing-value-rows-from-a-matrix-tp1461305p1461305.html Sent from the R help mailing list archive at Nabble.com.
Hi r-help-bounces at r-project.org napsal dne 03.02.2010 16:53:20:> > Hi everyone, > I have a matrix with many Na's. Some rows contain some Na's and someothers> are entirely composed of Na's. I want to delete the rows that areentirely> composed of Na's but not the other ones so I can't use a simpleremoveNA.> Has any one an idea?Untested data[rowSums(is.na(data))<ncol(data),] Regards Petr> > ----- > Anna Lippel > -- > View this message in context:http://n4.nabble.com/Delete-missing-value-rows-> from-a-matrix-tp1461305p1461305.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Hello, You can run a row-wise all( is.na( ) ). You will then detect rows consisting of NAs only. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com anna wrote:> Hi everyone, > I have a matrix with many Na's. Some rows contain some Na's and some others > are entirely composed of Na's. I want to delete the rows that are entirely > composed of Na's but not the other ones so I can't use a simple removeNA. > Has any one an idea? > > ----- > Anna Lippel