2
I would like to know how I can calculate the majority vote step by step, for example by comparing column 1 with 2, per line, then 1,2 and 3, per line, then 1, 2,3 and 4, per line and so on.
set.seed(1)
a = matrix(sample(1:6, 30, replace = T), ncol = 5)
I mean, I take the line i
compare all elements, calculate the element that appears the most times and return the same, being as output a matrix with i
lines and j-1
columns .
You edited the question but did not return Carlos' answer. She does not answer you? If not, why? Comment on his response so he can adapt the code, no doubt possible. It would be better if you post the desired output beyond the explains in his text.
– Molx
Learning politics yet, rsrs. Grateful!
– Wagner Jorge