Network analysis statnet help

Just wondering if anyone can see what I'm doing wrong in the code below, there are three different "roles" in the data and I'm trying to colour the vertices in the network graph (excluding isolates) to match their role i.e role 1 = red , role 2 =blue etc.

Thanks for any insight :slight_smile:

y <- gangs
n <- dim(y[, ])[1]

isolates<-sna::isolates(y)
network::delete.vertices(y,isolates)

par(mar = rep(1.5, 4))

set.seed(1)

plot(y,
vertex.col(y%v%'role'==1)<-'red',
vertex.col(y%v%'role'==2)<-'blue',
vertex.col(y%v%'role'==3)<-'green',
vertex.cex = 5,
label = 1:n,
label.cex = 0.6,
label.pos = 5
)

legend('bottomright',
legend = c('Leader (1)', 'Thug(2)', 'Lackie(3)'),col = c('red', 'blue, 'green'), lty = 1, lwd = 2,cex=0.6)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.