1

我有一堆 .net 文件格式的 pajek 网络,但不能再使用网络包中的 read.paj 导入它。它在窗户下工作。有人可以帮忙吗?

read.paj(file.path) 只返回 NULL

read.paj 函数中 debug=True 下的输出:

[1] "nextline called... new loop started"
[1] "vertex list set"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "arc or edge lines present"
[1] "length of dyad list 0"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "nextline called... new loop started"
[1] "arc or edge lines present"
[1] "length of dyad list 0"
[1] "nextline called... new loop started"
[1] "nnetworks= 0"
[1] "network.names= "
[1] "vertex null? FALSE"
[1] "network.title= 0"
[1] "vector null? TRUE"
[1] "colnames.vector= "
[1] "projects null? TRUE"
[1] "nprojects= 0"
[1] "names.projects= "
[1] "number of networks 0"
[1] "number of projects 0"
####### .net 文件内容
*Vertices 19

1 "1"

2 "2"

3 "3"

4 "4"

5 "5"

6 "6"

7 "7"

8 "8"

9 "9"

10 "10"

11 "11"

12 "12"

13 "13"

14 "14"

15 "15"

16 "16"

17 "17"

18 "18"

19 "19"

*Edges

1 2   

1 6

1 7

1 16

1 18

2 6

2 7

2 11

2 15

2 18

3 5

3 8

3 14

3 15

3 16

4 5

4 6

4 8

4 13

4 14

4 16

4 19

6 7

6 8

6 11

6 13

6 14

6 18

6 19

7 9

7 10

7 11

7 12

7 14

7 15

7 18

7 19

8 11

8 13

8 14

8 15

8 19

9 10

9 11

9 12

9 15

9 19

10 11

10 12

10 15

10 16

10 17

10 19

11 12

11 13

11 14

11 15

11 18

11 19

12 15

12 19

13 14

13 18

13 19

14 15

14 16

14 18

14 19

15 19

16 17

16 19

17 19

18 19
4

1 回答 1

1

I'm not sure about why read.paj from "network" does not work... BUT but you could try read.graph from package "igraph" and then use asNetwork from package "intergraph" to get the data as an object of class network:

library(igraph)
g <- read.graph("z.net", format="pajek")   # that's your file
g

# IGRAPH U--- 19 73 -- 
# + attr: id (v/c)


library(network)
library(intergraph)
net <- asNetwork(g)
net

# Network attributes:
#  vertices = 19 
#  directed = FALSE 
#  hyper = FALSE 
#  loops = FALSE 
#  multiple = FALSE 
#  bipartite = FALSE 
#  total edges= 73 
#    missing edges= 0 
#    non-missing edges= 73 
#
# Vertex attribute names: 
#    id vertex.names 
#
# No edge attributes
于 2014-08-28T22:30:24.213 回答