[R] Odp: Extract NA data rows

Petr PIKAL petr.pikal at precheza.cz
Tue Jan 25 09:37:33 CET 2011


Hi

r-help-bounces at r-project.org napsal dne 25.01.2011 08:07:10:

> 
> hi i have the following dataframe 
> 
> x   y
> 1   345
> 6   NA
> 8   123
> 32   123
> 12   NA
> 6   124
> 7   NA
> 
> and i want to extract the data rows which contains "NA" data, I tried
> 
> subset(dataframe,y=="NA") 

See

?is.na

however ?complete.cases is my preferred choice when working with data 
frames and several columns.

dataframe[complete.cases(dataframe),]

Regards
Petr

> 
> but fail. if you know the answers, please let me know thanks.
> 
> typhoong
> 
> 
> 
> 
> 
> 
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/Extract-NA-data-
> rows-tp3235568p3235568.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 guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list