Hello,

I have a matrix mat (see dput(mat))

> mat
      [,1] [,2]
 [1,]    5    6
 [2,]    6    5
 [3,]    5    4
 [4,]    5    5
 ....

 I want the frequencies of the pairs in a new matrix, whereas the
combination 5 and 6 is the same as 6 and 5 (see the first two rows of mat).
In other words: What is the probability of each combination (each row)
ignoring the order in the combination. As a result I would like to have a
matrix that includes rows and cols 0, 1, 2 ... max (mat) that do not appear
in my matrix.

 dput (mat)
structure(c(5, 6, 5, 5, 4, 3, 6, 7, 4, 7, 5, 5, 5, 5, 6, 5, 5,
4, 3, 6, 7, 4, 7, 5, 5, 5, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7,
6, 6, 5, 4, 5, 5, 7, 5, 6, 3, 5, 6, 7, 6), .Dim = c(26L, 2L))

Thanks
Hermann

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to