[R] How to replace all non-maximum values in a row with 0

burgundy sauburn at yahoo.com
Fri Apr 9 10:04:14 CEST 2010


Hi,

I would like to replace all the max values per row with "1" and all other
values with "0". If there are two max values, then "0" for both. Example:

from:
2  3  0  0  200
30 0  0  2  50
0  0  3  0  0
0  0  8  8  0

to:
0  0  0  0  1
0  0  0  0  1
0  0  1  0  0
0  0  0  0  0

Thanks!
-- 
View this message in context: http://n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p1819018.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list