I'm new to R/network analysis, and apologize if this is a stupid question. I'm currently trying to convert an edgelist into a network matrix, where the shared category of a group indicates the presence of an edge. (ie. 1 if they are in the same group, 0 if they are not... it might also be possible to indicate different numbers depending on the group... 1 for the first, 2 for the second, etc.)
If this helps, here's a sample of my data (I'm working with two data sets, much larger than this):
edgelist:
netherlands, business and human rights
burkina faso, business and human rights
japan, business and human rights
china, civil and political rights
myanmar, civil and political rights
fiji, civil and political rights
netherlands, civil and political rights
japan, civil and political rights
ethiopia, civil society
egypt, civil society
myanmar, civil society
matrix:
burkina faso, china, japan, netherlands, ethiopia, egypt, myanmar, fiji
burkina faso, 0, 1, 1, 0, 0, 0, 0, 0
china 0, 0, 1, 1, 0, 0, 1, 1
japan 1, 1, 0, 1, 0, 0, 1, 1
netherlands 1, 1, 1, 0, 0, 0, 1, 1
ethiopia 0, 0, 0, 0, 0, 1, 1, 0
egypt 0, 0, 0, 0, 1, 0, 1, 0
myanmar 0, 0, 0, 0, 1, 1, 0, 0
fiji 0, 1, 1, 1, 0, 0, 0, 0
etc.
I've tried reshape
and as.integer
but am struggling to know how that might work in my case...
Thanks in advance, everyone.