问题
I have a lot of .net files, and the package tutorial says it is possible to use this format with sna.
My error message is:
> Error in FUN(X[[1L]], ...) : as.edgelist.sna input must be an
> adjacency matrix/array, edgelist matrix, network, or sparse matrix, or
> list thereof.
How can I open .net files with sna package in R? I browsed the net but I couldn't find any helpful information to my problem.
I have no problem with using package igraph, but there are some pros to use package sna, too.
Thank you in advance.
P.S. I tried to read pajek with library(network):
b1<- read.paj("15.net")
Warning message:
In readLines(file, 1, ok = TRUE) : incomplete final line found on '15.net'
回答1:
If it works with 'igraph', do it with 'igraph'. Then convert the data to a form acceptable by functions in the 'sna' package. For example with asNetwork
function from package 'intergraph' you can convert igraph
object to a network
object (package 'network'), which you can use with 'sna'.
来源:https://stackoverflow.com/questions/36239085/how-can-i-open-net-files-with-package-sna-in-r