如何在R中使用sna软件包打开.net文件? [英] How can I open .net files with package sna in R?

查看:299
本文介绍了如何在R中使用sna软件包打开.net文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多.net文件,并且软件包教程说可以在sna上使用这种格式.

I have a lot of .net files, and the package tutorial says it is possible to use this format with sna.

我的错误消息是:

> Error in FUN(X[[1L]], ...) :    as.edgelist.sna input must be an
> adjacency matrix/array, edgelist matrix, network, or sparse matrix, or
> list thereof.

如何在R中使用sna包打开.net文件?我浏览了网络,但找不到任何有关我的问题的有用信息.

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.

我使用package igraph没问题,但是使用sna软件包也有一些优点.

I have no problem with using package igraph, but there are some pros to use package sna, too.

谢谢.

P.S.我试图通过库(网络)阅读pajek:

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'

推荐答案

如果与"igraph"一起使用,请与"igraph"一起使用.然后将数据转换为"sna"包中的函数可接受的格式.例如,使用包'intergraph'中的asNetwork函数,可以将igraph对象转换为network对象(包'network'),可以将其与'sna'一起使用.

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'.

这篇关于如何在R中使用sna软件包打开.net文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆