我正在尝试从两个不同的制表符分隔文件中读取边缘列表,将其转换为igraph中带有函数的邻接矩阵,然后将这些矩阵组合成我需要的3d数组,作为另一个函数的输入(sna包中的qaptest) 。我已经完成了大部分工作,但是将它们组合在一起的最后一个数组语句未产生预期的结果。这在下面的运行/输出中显示。谁能告诉我我在做什么错?
>obs <- read.table("002-obs.txt",sep="\t", header=FALSE)
>per <- read.table("002-per.txt",sep="\t", header=FALSE)
# load igraph
>mper <- AdjacencyFromEdgelist(per, check.full = TRUE)
>mper
$adjacency
[,1] [,2] [,3]
[1,] 0 7 3
[2,] 7 0 4
[3,] 0 0 0
$nodelist
[1] 7314 9539 9794
>mobs <- AdjacencyFromEdgelist(obs, check.full = TRUE)
>mobs
$adjacency
[,1] [,2] [,3]
[1,] 0.00 155.25 55.75
[2,] 258.75 0.00 77.50
[3,] 0.00 0.00 0.00
$nodelist
[1] 7314 9539 9794
> dat<-array(c(mper,mobs),c(3,3,2))
> dat
, , 1
[,1] [,2] [,3]
[1,] Numeric,9 Integer,3 Numeric,9
[2,] Integer,3 Numeric,9 Integer,3
[3,] Numeric,9 Integer,3 Numeric,9
, , 2
[,1] [,2] [,3]
[1,] Integer,3 Numeric,9 Integer,3
[2,] Numeric,9 Integer,3 Numeric,9
[3,] Integer,3 Numeric,9 Integer,3