mymat <- structure(c(1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1
), .Dim = c(3L, 5L))
> mymat
[,1] [,2] [,3] [,4] [,5]
[1,] 1 -1 -1 1 1
[2,] 1 -1 1 1 1
[3,] 1 -1 -1 1 -1
I want to take the majority vote across the columns of mymat
. In this example, the majority vote results across the 5 columns are: 1 -1 -1 1 1
.
I've tried looking at the solutions from a similar question here, but since the columns in mymat
are unnamed, these solutions did not work for me.