Please consider the following
library(igraph)
id <- c(\"1\",\"2\",\"A\",\"B\")
name <- c(\"02 653245\",\"03 4542342\",\"Peter\",\"Mary\")
category <- c(
The answer might be useful. My recommendation is same as of @Gabor Csardi about id as name, and name as real_name.
library(igraph)
name <- c("1","2","A","B")
real_name <- c("02 653245","03 4542342","Peter","Mary")
category <- c("digit","digit","char","char")
from <- c("1","1","2","A","A","B")
to <- c("2","A","A","B","1","2")
nodes <- cbind(name,real_name,category)
edges <- cbind(from,to)
g <- graph.data.frame(edges, directed=TRUE, vertices=nodes)
list.vertex.attributes(g)
#Output: [1] "name" "real_name" "category"
which(V(g)$real_name == "Peter")
#Output: [1] 3
V(g)$name[which(V(g)$real_name == "Peter")]
#Output: [1] "A"