Re: [R] how to threshold a matrix
Try: (M >= 0.3) - (M <= 0.3) On Dec 15, 2007 10:56 AM, affy snp <[EMAIL PROTECTED]> wrote: > Dear list, > > I have a matrix M (2500 rows and 9 columns). It looks like > > 2.2 0.1 2.63.6 .. > 0.4 1.9 2.74.2.. > 1.8 2.5 4.32.2... >
[R] how to threshold a matrix
Dear list, I have a matrix M (2500 rows and 9 columns). It looks like 2.2 0.1 2.63.6 .. 0.4 1.9 2.74.2.. 1.8 2.5 4.32.2... . If I want to do: (1) if M[i,j]>=0.3, M[i,j]=1 (2) if M[i,j]<=-0.3, M[i,j]=-1 (3) Otherwise, M[i,j]=