[BioC] Subtraction with NA values

Daniel F. Simola simola at mail.med.upenn.edu
Wed Feb 11 02:33:03 MET 2004


I have a microarray experiment using dye-swapped slides. I am trying to 
combine (average) the intensities of a gene from a slide and its 
dye-swapped pair, but just discovered that the subtraction operator in 
R does not work the way I would like it to for missing (NA) values.

I am doing: ( M - M' ) / 2, where M is an array of intensities for 
genes, and M' is the same, except dye-swapped.

Say I want the result of " 5 - NA ", where 5 is the intensity of one 
spot and NA is that of the same spot on the dye-swapped slide, then I 
get NA for an answer. Because I want to average the values ( 5 - NA / 2 
), then I would like my average value to be 5, instead of NA. Thus it's 
better to make use of the available data than disregard a gene 

So, does anyone know either of a workaround for this, or of a function 
that I can use to perform element-wise subtraction over a matrix that 
will work how I want (or that will let me define my own function to be 
applied on an element wise basis)?

Thanks a lot,
Dan Simola

More information about the Bioconductor mailing list