For a matrix (as.matrix), how can I generate a table where rows are equal to rows of the matrix?
>table(matrix)
and
&g
## source data x=as.matrix(read.table(text=" 1 2 3 4 a 5 5 4 6 b 5 5 5 5 c 8 7 6 6 d 2 6 6 6 e 7 7 5 4 ")) # result table(rep(rownames(x),ncol(x)),c(x)) # 2 4 5 6 7 8 # a 0 1 2 1 0 0 # b 0 0 4 0 0 0 # c 0 0 0 2 1 1 # d 1 0 0 3 0 0 # e 0 1 1 0 2 0