[R] adjacency matrix
Mehdi Ghafariyan
mehdi_ghafariyan at yahoo.com
Thu Sep 21 15:31:02 CEST 2000
Hi all;
I have two vectors A=c(5,2,2,3,3,2)
and B=c(2,3,4,5,6,1,3,2,4,3,1,5,1,4,6,1,4)
and I want to make the following matrix
using the information I have from the above
vectors.
0 1 1 1 1 1
1 0 1 0 0 0
0 1 0 1 0 0
1 0 1 0 1 0
1 0 0 1 0 1
1 0 0 1 0 0
so the first vector says that I have 6
elements therefor I have to make a
6 by 6 matrix and then I have to read
5 elements from the second
vector , and put 1 in [1,j] where j=2,3,4,5,6
and put zero elsewhere( i.e. in [1,1])
and so on.
Any idea how this can be done in R ?
cheers
Mehdi
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list