I am new to igraph and social network analysis, but not to R.
I am struggling to correctly structure my dataset for community detection, but have successfully used iGraph to generate a co-occurence matrix as directed [here]. What I would like to do next is use a community detection algorithm on the same dataset to create a graph showing clusters as is done in the answer here.
The sample code for how to do this is as follows:
df1 <- graph.famous("Zachary")
df2 <- walktrap.community(df1) #any algorithm
plot.communities(df2, df)
I've been poking around on the web to find out the structure of the Zachary dataset so I can correctly model my data, but am struggling to find my way through the technical documentation.
My data is currently structured in long form, such that:
id interest comments
1 Comedy 2
1 Music: Electronic 11
1 Video Gaming 10
1 Music: Pop 1
1 Entertainment 1
1 Video Gaming 4
2 Video Gaming 45
2 Entertainment 26
2 Music: Pop 1
2 Comedy 14
3 Video Gaming 10
3 Entertainment 4
3 Comedy 8
4 Video Gaming 9
4 Music: Electronic 1
4 Music: Pop 2
5 Music: Pop 2
5 Entertainment 1
5 Video Gaming 1
6 Video Gaming 12
I am trying to find clusters of overlapping interest in the population I am studying, so the ID
is a person, the interests
are the person's interests, and comments
is an index of how many times they have shown interest. Does this help?
I've tried to run the community algorithms on this dataset (e.g. df2 <- walktrap.community(df)
) but that doesn't seem to work correctly. Thoughts on what this n00b is doing wrong?