Firstly I'm very new to R so apologies if this is a simple question.
I have a .csv with an edge network of groups, people associated with them and some attributes of both the people and groups
e.g.
Group Person PersonGame GroupGame
A Jane Doe Snooker Tennis
B John Doe Football Football
A Bill Smith Tennis Tennis
B Francis Underwood Football Football
A Francis Underwood Football Tennis
I've drawn a bipartite network:
df <- read.csv("file.csv", header = TRUE, sep = ",")
df.network <- graph.data.frame(df, directed = F)
V(df.network)$type <- bipartite.mapping(df.network)$type
Currently I've coloured the Group and Person vertexes differently as follows:
V(df.network)$color <- ifelse(V(df.network)$type, "grey", "orange")
what I really want to do though is colour the Person vertexes differently depending on the "Person Game" field, but this doesn't seem to be an attribute that I can access for a Vertex, only an Edge. So this works to colour the edges:
E(df.network)$color <- ifelse(E(df.network)$PersonGame=='Snooker',
"red", ifelse(E(df.network)$PersonGame=='Football', "blue", "orange"))
but it doesn't work if I apply to vertexes instead of edge as I can't get the PersonGame attribute to apply to a vertex.
Can anyone help?