Hi,

Just two variant's of David's solution:
 idx<-apply(mydata[-1],2,function(x) any(!x %in% c(0,5)))
idx
   x1    x2    x3    x4 
 TRUE FALSE FALSE FALSE 
 idx<-c(TRUE,idx)
 mydata[,idx]
#second
idx<-apply(mydata[-1],2,function(x) all(ifelse(x!=0 & x!=5,TRUE,FALSE )))
 mydata[,c(TRUE,idx)]
  n x1
1 5  2
2 5  3
3 5  1
4 5  3
A.K.




______________________________________
If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/sub-setting-a-data-frame-with-binomial-responses-tp4638702p4638833.html
This email was sent by arun kirshna (via Nabble)
To receive all replies by email, subscribe to this discussion: 
http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=subscribe_by_code&node=4638702&code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDYzODcwMnwtNzg0MjM1NTA4
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to