x <- cbind(a=c(11,22,44,15),
b=c(21,12,22,19),
c=c(35,66,12,20))
rownames(x) <- c('p', 'q', 'r', 's')
XX <- cbind(rbind(x, MIN = apply(x, 2, min)), MIN = c(apply(x, 1, min), NA))
xx
# a b c MIN
# p 11 21 35 11
# q 22 12 66 12
# r 44 22 12 12
# s 15 19 20 15
# MIN 11 12 12 NA
I want to know within the row MIN and column MIN which element is rank least, the next to the least, and the next up to the highest value just like this:
# a b c MIN RANK
# p 11 21 35 11 1
# q 22 12 66 12 2.5
# r 44 22 12 12 2.5
# s 15 19 20 15 4
# MIN 11 12 12 NA NA
# RANK 1 2.5 2.5 NA NA