Re: [R] subset data frame by variable with missing value

2012-11-30 Thread arun
Hi, YOu could also use: set.seed(5) dat1<-data.frame(col1=sample(c(1:4,NA),10,replace=TRUE),col2=runif(10,0,1))  dat1[!complete.cases(dat1),] #  col1  col2 #3   NA 0.3184040 #8   NA 0.8878698 #9   NA 0.5549226 A.K. - Original Message - From: ramoss To: r-help@r-project.org Cc: Sent

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread ramoss
I found the answer; Its mymissing <- subset(mydata,is.na(myvar)) -- View this message in context: http://r.789695.n4.nabble.com/subset-data-frame-by-variable-with-missing-value-tp4651439p4651440.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Milan Bouchet-Valat
Le vendredi 30 novembre 2012 à 07:27 -0800, ramoss a écrit : > Hello, > > I have a variable in a data frame that contains NA values. I just want to > subset so that I get the obs where that variable is missing. > In SAS I would do: > > data missing; > set test; > if myvalue=' '; > run; > > H

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread PIKAL Petr
Hi see ?is.na x <-sample(c(1:3, NA), 20, replace=T) x [1] 2 NA 2 3 3 3 3 2 3 NA 3 2 1 2 NA 3 3 3 2 2 y<-rnorm(20) y[is.na(x)] [1] 0.1600417 1.3264063 -0.6175832 Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > proj

Re: [R] subset data frame by variable with missing value

2012-11-30 Thread Marc Schwartz
On Nov 30, 2012, at 9:27 AM, ramoss wrote: > Hello, > > I have a variable in a data frame that contains NA values. I just want to > subset so that I get the obs where that variable is missing. > In SAS I would do: > > data missing; > set test; > if myvalue=' '; > run; > > How can I perform t