Re: [R] sub setting a data frame with binomial responses

2012-08-02 Thread arun kirshna [via R]
Hi, Just two variant's of David's solution: idx<-apply(mydata[-1],2,function(x) any(!x %in% c(0,5))) idx x1x2x3x4 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

Re: [R] sub setting a data frame with binomial responses

2012-08-01 Thread David L Carlson
If I understand you correctly you want to exclude columns where all successes equal trials, all successes equal 0, or successes are a mixture of trials and 0 with no in between values. You did not make it clear if the number of trials can vary, but in your example they do not. Given that all thr