Hey guys do you know how can I make a list of the pair of elements whose combination is the most frequent? imagine that I have two vectors I perform a cross tabulation and I want to find the pair of those two vectors that is the most frequent. and have it as a list eg (2,3), this means that the element 2 of the first vector and the element 3 of the second vector their combination is the most frequent. for example :
mp<- c(1,1,1,1,2,2,3,4)
mp1<- c("red", "red", "red", "red", "blue", "blue", "green", "pink")
table(mp,mp1)
mp1
mp blue green pink red
1 0 0 0 4
2 2 0 0 0
3 0 1 0 0
4 0 0 1 0
I can see that the most frequent pair is (1, "red") but how can I get that as a result?