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.6 3.6 ...... > 0.4 1.9 2.7 4.2...... > 1.8 2.5 4.3 2.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]=0 > > Is there a way to ceil and floor the data? > > Thanks a lot! > > Allen > > [[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. > ______________________________________________ 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.