Let's suppose I have the following matrix:
some_matrix <- matrix(c(2,2,2,1,3,1,3,1,3),nrow=3,ncol=3)
I am trying to get the frequencies of the values 1,2 and 3 per column. More precisely, I would like to get a data frame that shows the frequencies for all different values in column 1 and so on for the other columns. That is something like the following:
goal <- matrix(c(0,2,1,3,0,0,0,1,2),nrow=3,ncol=3)
I would appreciate some help! Thank you very much!