I'm in doubt, I'd like to get the element a[1]
and compare with b[1,1]
and count as success, then the a[2]
element compared to b[2,1]
and so on, always per column. Then I want to compare a[1]
with b[1,2]
and count as right, then the a[2]
element with the b[2,2]
element and so on. Then return the column of b to which you got the most hits.
set.seed(1)
a = sample(1:3, 4, replace = T)
b = matrix(sample(1:3, 20, replace = T), ncol = 5, byrow = T)
The desired answer would be column 2 or 5 that would tie randomly to one of the columns.
Thank you in advance.