[R] Extract NA data rows

Ivan Calandra ivan.calandra at uni-hamburg.de
Tue Jan 25 09:39:52 CET 2011


Hi!

Try
subset(dataframe, is.na(y))

or
df[is.na(df$y),]

HTH,
Ivan

Le 1/25/2011 08:07, typhoong a écrit :
> 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")
>
> but fail. if you know the answers, please let me know thanks.
>
> typhoong
>
>
>
>
>
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php



More information about the R-help mailing list