I would like how to calculate the mode of all rows or columns from a matrix.
For example, I have:
seq <- c(1,2,3)
seq1 <- rep(seq, each=4)
mat1 <- matrix(seq1, 3)
mat1
rows <- c(1,2,3)
columns <- c("a", "b", "c", "d")
colnames (mat1) <- columns
rownames (mat1) <- rows
mat1
a b c d
1 1 1 2 3
2 1 2 2 3
3 1 2 3 3
Now, I want to calculate the mode of each row and column. Thanks in advance