Similar to this SO question, I have a data.frame of floats which I would like to convert to a set of Boolean values.
Specifically, I would like to go through a matrix (data.frame) where each cell is replaced with "if this cell is the maximum of all cells in this row"
For example, given the following data.frame,
row.names net.result.1 net.result.2 net.result.3 net.result.4
1 0.000013, 0.0156616, 0.000005, 0.999959
2 0.000046, 0.0145417, 0.000005, 0.999945
3 0.938103, 0.0043157, 0.000007, 0.002126
4 0.000000, 0.0000000, 0.999811, 0.000000
Produce the following binary values:
FALSE, FALSE, FALSE, TRUE
FALSE, FALSE, FALSE, TRUE
TRUE, FALSE, FALSE, FALSE
FALSE, FALSE, TRUE, FALSE
How would I go about doing this?