Subscript out of bounds error when using an adjacency matrix in r -


i error when applying function adjacency matrix in r.

the adjacency matrix looks this:

s2     1   2   3   4   5   7   8   9   6 1   0   1   2   3   3   0   0   0   0 2   1   0   0   0   1   1   2   2   0 3   2   0   0   0   0   1   0   4   2 4   3   0   0   0   0   0   0   0   0 5   3   1   0   0   0   0   0   0   0 7   0   1   1   0   0   0   0   0   0 8   0   2   0   0   0   0   0   0   0 9   0   2   4   0   0   0   0   0   0 6   0   0   2   0   0   0   0   0   0 

the code follows:

library(igraph)  library(egonet)  x<-index.egonet(s2) 

when apply index.egonet gives me error subscript out of bounds.

any or solution problem highly appreciated.

your ego subject (parameter ego.name) not defined.

the following, defining first person ego person works:

library(igraph) library(egonet) s2 <- c(0,1,2,3,3,0,0,0,0, 1,0,0,0,1,1,2,2,0, 2,0,0,0,0,1,0,4,2, 3,0,0,0,0,0,0,0,0, 3,1,0,0,0,0,0,0,0, 0,1,1,0,0,0,0,0,0, 0,2,0,0,0,0,0,0,0, 0,2,4,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,0) s2 <- matrix(s2,nrow=9)  colnames(s2) <- rownames(s2) <- paste0(as.character(c(1:5,7:9,6))) x<-index.egonet(s2,ego.name = "1") 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - How can I echo out this array? -

javascript - IE11 incompatibility with jQuery's 'readonly'? -