The question is straightforward. I started using dplyr but cannot come up with a solution of how to rank the values in each row. The ultimate goal would be to assign a rank to each value and for each row. I tried the following that didn't work:
mat_agg %>% rowwise() %>% mutate_each(funs(rank))
An example is:
matrix(c(1,0,0.5,0.5, 0, 1),nrow=2)
The desired outcome would be:
matrix(c(1,3,2,2, 3, 1),nrow=2)
I very much appreciate any help. Thank you!