Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package.
I am trying to select a list of genes which all have expression values below a certain threshold. I have done this by creating a vector which has 0s where the expression is greater than the threshold and 1s where it is less than or equal to it. Multiplying this vector by the expression values produces a list of 0s and expression values below the threshold value. However, now I need to remove the 0s. I thought that this would be relatively trivial but it appears it isn't!!! The dimension of the list (with the 0s and values) is 506994. So I wrote the following: for(i in 1:506994) { if(exp2[i] > 0) { exp3 <- append(1,exp2[i]) } return(exp3) } where exp2 is the vector of 0s and threshold values. However I have since discovered that 'if' does not work on vectors. The suggestions I have seen on this forum include 'ifelse' which I don't believe to be relevant in this situation and 'sapply' which again I don't think is relevant. Can anyone therefore tell me how I can produce a new vector from an old one by removing the 0 entries? Thank you for your help, Laura University of Warwick [[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.