I have few queries. I am having a matrix with some counts. there are 2 conditions for each. So I have a matrix with first column as genes and 12 columns with counts. After first gene column next 6 columns are one condition and the second 6 columns are another condition. I want to remove the rows where each condition is having one 0 column. So for a rows if in both the conditions have one single 0 (which means each condition is having a 0 value) then that row is removed. How can we do that. I was doing like this earlier but we are left with some rows.

```
data1<- read.table("~/Desktop/Bonn_New_Pas_algo_data/results_30092013/edgeR_24122013/PGRTvsPDGRT/PGRTvsPDGRT_frags.txt",header=TRUE,stringsAsFactors=FALSE)
mat1<- as.matrix(data1[,-1])
row.names(mat1)<- data1[,1]
test <- apply(mat1, 1,function(x) all(x[1:6]==0) | all(x[7:12]==0) )
test1 <- mat1[!test,]
```

But this does not seem correct as I am having some rows like :

```
XLOC_004043 251 233 116 61 79 73 163 287 120 103 0 60
XLOC_004046 75 0 1 1 1 53 1 1 1 0 33 1
XLOC_004048 26.0133 0 0 0 0 232.296 2.676 8.21482 2.61507 0 0 0
XLOC_004050 0 1 4 36 20 0 0 2 1 0 1 9
```

output

```
XLOC_004043 251 233 116 61 79 73 163 287 120 103 0 60
```

The script i wrote is not working , can anyone suggest how to do it?

Well, I have 20 columns with counts and two groups. I want to remove the rows where each group is having at least five 0 columns. First group 1:10 and second is 11:20. How can I use this line? Thank you.