i have a two-mode network edgelist data like tmp
below:
tmp <- read.table(text="PersonID CompanyID
P1 C000001
P2 C000001
P3 C000001
P4 C000001
P5 C000001
P6 C000002
P7 C000002
P8 C000002
P9 C000003
P10 C000003
P11 C000003
P12 C000003",header=TRUE)
# make a graph using this data
el <- graph.edgelist(as.matrix(tmp))
And I did this to add "type" attribute to create a bipartite graph in igraph
V(el)$type <- V(el)$name %in% el[,1]
But it turned that the type is all "false" and the names can't match. Does anyone know what's going wrong here?
> table(V(el)$type)
FALSE
15
> V(el)$name
[1] "P1" "C000001" "P2" "P3" "P4" "P5" "P6" "C000002"
[9] "P7" "P8" "P9" "C000003" "P10" "P11" "P12"