I wanted to measure closeness centrality, specifically incloseness and outcloseness, with the igraph package in R version 3. I used the dataset "flo" in the package "network" to do the analysis. the density (graph.density) and centralization (centralization.degree) functions of igraph package worked fine. but the closeness function showed errors. The code and the errors are posted below:
code:
library(network)
library(igraph)
data(flo)
gr <- graph.adjacency(flo, mode="undirected")
closeness(gr)
error:
Error in FUN(X[[1L]], ...) :
as.edgelist.sna input must be an adjacency matrix/array, edgelist matrix, network, or sparse matrix, or list thereof.
I am new to network analysis and the R packages for the analysis. Can someone please show me what went wrong and how to do it?
sna
package and that has acloseness
function, too? Or you are using a very old version of R perhaps? – Gabor Csardi