I am currently working with a bipartite network with two distinct modes and two distinct sets of attributes. So row 1 through 5 is a mode and actors A, B and C are a different mode who form some connection marked by a 1.
a<-replicate( 3, numeric(5) )
b<-apply(a, c(1,2), function(x) sample(c(0,1),1))
rownames(b) <- rownames(c(1,2,3,4,5))
colnames(b) <-colnames(c("A","B","C"))
b
A B C
[1,] 1 0 1
[2,] 1 0 1
[3,] 0 0 0
[4,] 0 1 1
[5,] 1 1 0
c<-as.network(b, directed=T, bipartite =3)
e<-c('A',"B","C")
f<-c('tall','short','tall')
g<-data.frame(e,f)
colnames(g)<-c('person','height')
g
person height
A tall
B short
C tall
How do I assign the height attribute from data frame g to only the actors A, B and C? So far, I have tried set.vertex.attribute according to the position of the vertices of A, B and C
set.vertex.attribute(c, attrname= 'height', g$height, v = network.vertex.names(c)[6:9])
but I get the following error
Vertex ID does not correspond to actual vertex in set.vertex.attribute.