I want to create an adjacency matrix to use in social network analysis (likely with graph_from_adjacency_matrix in igraph) from a csv that is structured like this (but much larger):
name vote1 vote2 vote3
Joe 1 0 1
Jane 0 0 1
Jill 1 0 1
For the network analysis, the node will be the name variable, and the nodes will be connected by how frequently they vote together (1 or 0). Something like:
Joe Jane Jill
Joe 0 2 3
Jane 2 0 2
Jill 3 2 0
As simple as this seems, I haven't been able to successfully convert this dataframe into an adjacency matrix that can be used to create an igraph graph object. as.matrix and data.matrix do convert it to a matrix, but not an adjacency matrix, and not one that preserves the characters in the "name" variable. My matrix algebra is not strong, so I know I'm likely missing something obvious, but I don't know enough to know what it is. I'm open to other solutions that get me to my end goal of network analysis.