i working list of network graphs (i.e., 1000+ adjacency matrices) i'm analyzing igraph package. graphs stored in split file, each graph having unique id.
i have calculated individual nodes' betweenness centrality scores in each respective graph, using following code:
b <- function (b) betweenness(b, directed = false, normalized = true) between <- lapply (listofgraphs, b) show(between) #looks this: $`35630` #graph id 1676 1741 1750 #node id 0 1 0 #scores $`35631` 1738 1750 0 1 $`35633` 1738 1750 4110 0 0 0
now, need 1 dataframe colums graph id's, node id's , individual scores betweenness. this:
graph.id node.id betweenness 35630 1676 0 35630 1741 1 35630 1759 0 35631 1738 0 35631 1750 1 35631 1738 0 35633 1750 0 35633 et cetera .....
i've tried unlist, rbind , such, reason can't work. if me amazing!
we melt
list
after stack
ing named vector
s in list
library(reshape2) melt(lapply(between, stack))[-2]
Comments
Post a Comment