[R] A co-occurrence matrix
Alexey Shipunov
a.shipunov at rbgkew.org.uk
Tue Nov 11 11:49:43 CET 2003
Dear R experts,
I have a matrix (from some sort of
classification) like this:
object group
[1,] 1 1
[2,] 2 2
[3,] 3 1
[4,] 4 1
[5,] 5 3
And I need something like this:
[,1] [,2] [,3] [,4] [,5]
[1,] 1 0 1 1 0
[2,] 0 1 0 0 0
[3,] 1 0 1 1 0
[4,] 1 0 1 1 0
[5,] 0 0 0 0 1
where all zeros mean that these objects are not
in same group, and vice versa.
Is there a relatively simple way to construct co-
uccurence matrices of type shown above?
Any help would be appreciated,
=================================
Dr. Alexey B. Shipunov
Section of Molecular Systematics
Jodrell Laboratory
Royal Botanic Gardens, Kew,
Richmond, Surrey, TW9 3DS, U.K.
e-mail: a.shipunov at rbgkew.org.uk
More information about the R-help
mailing list