I've created a cluster in R from a data frame using the code below:
myvars <- c("member_screen_name", "friend_screen_name", "party")
newdata <- total[myvars]
#just using 30 rows
x <- newdata[sample(nrow(newdata), 30), ]
g <- graph_from_data_frame(x, directed = FALSE)
plot(g)
I'm trying to change the color of each vertex according to their "party" association, either Democratic (D) or Republican (R). I know I can change the color of all vertices by doing the following:
plot(g,vertex.color='red')
How do I change the color of each vertex according to the "party"?