Hello,

This should be a fairly simple question. I have 2 matrix's and I want to get
the difference between them and then remove the difference from one of them.
So A vs B, anything I see in B I want to remove from A, and then print out
the final matrix.

I have some code here but at the moment I'm getting stuck on the creating a
matrix, cbind problems. 

 

clean <- function (A, B, rt=10, mass=0.01, pval=0.01){

            i <-0

            j <-0

            d.A <-dim(A)

            d.B <-dim(B)

            clean <-0

            for (i in i:d.A[1]){

                        for (j in j:d.B[1]){

                                    if(any((A[i,6] - B[j,6]) <= mass)){

                                                if (any((A[i,9] - B[j,9])<=
rt)){

                                                            if (B[j,5] >=
pval){

 
clean<-cbind(clean,A[i,])

                                                            }

                                                }

                                    }

                        }

            }

            return (clean)

}

I hope that I have explained myself well. If not please let me know and I'll
try to explain more. 

 

Cheers,

 

PB

 

Research Technician

Mass Spectrometry

   o The

  /

o Scripps

  \

   o Research

  /

o Institute

 


	[[alternative HTML version deleted]]

