简体   繁体   English

igraph-错误的尺寸数警告:纸叠不平衡

[英]igraph - incorrect number of dimensions Warning: stack imbalance

I don't know why I can't use R script for igraph any more that worked before. 我不知道为什么我不能再使用R脚本进行igraph了。 I would really appreciate it if you could help me with this. 如果您能帮助我,我将不胜感激。 The script I used here is: 我在这里使用的脚本是:

library(igraph) 图书馆(igraph)

matrix1<-as.matrix(data) matrix1 <-as.matrix(数据)

matrix1 矩阵1

     var1 var2 var3 var4 var5 var6 var7 var8
[1,] 1.00 0.04 0.21 0.39 0.06 0.37 0.03 0.44
[2,] 0.04 1.00 0.34 0.36 0.63 0.25 0.66 0.18
[3,] 0.21 0.34 1.00 0.44 0.41 0.57 0.72 0.62
[4,] 0.39 0.36 0.44 1.00 0.28 0.14 0.51 0.10
[5,] 0.06 0.63 0.41 0.28 1.00 0.50 0.73 0.39
[6,] 0.37 0.25 0.57 0.14 0.50 1.00 0.50 0.65
[7,] 0.03 0.66 0.72 0.51 0.73 0.50 1.00 0.52
[8,] 0.44 0.18 0.62 0.10 0.39 0.65 0.50 1.00

graph.adjacency(matrix1,mode='undirected',weighted=TRUE) graph.adjacency(matrix1,mode ='undirected',weighted = TRUE)

"then I get error message below" “然后我在下面收到错误消息”

Error in d[i, ] : incorrect number of dimensions Warning: stack imbalance in '.Call', 51 then 50 d [i,]中的错误:维数错误警告:'。Call'中的堆栈不平衡,先51后再50

More information below: 以下是更多信息:

> str(matrix1)
 num [1:8, 1:8] 1 0.04 0.21 0.39 0.06 0.37 0.03 0.44 0.04 1 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:8] "var1" "var2" "var3" "var4" ...

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] igraph_0.6.5-2

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3       ggplot2_0.9.3.1   
 [5] grid_3.0.2         gtable_0.1.2       labeling_0.2       lattice_0.20-23   
 [9] MASS_7.3-29        Matrix_1.0-14      mgcv_1.7-26        munsell_0.4.2     
[13] nlme_3.1-111       plyr_1.8           proto_0.3-10       RColorBrewer_1.0-5
[17] reshape2_1.2.2     scales_0.2.3       stringr_0.6.2      tools_3.0.2    

> traceback()
4: c(list(), list(logical(0)))
3: .Call("R_igraph_weighted_adjacency", adjmatrix, as.numeric(mode), 
       weighted, diag, PACKAGE = "igraph")
2: graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, 
       diag = diag)
1: graph.adjacency(matrix1, mode = "undirected", weighted = TRUE)

Thanks! 谢谢!

The following works fine for me with igraph 0.6.5-2, R 3.0.1, OSX Lion, so please include some self contained code that reproduces your problem, also your igraph and R version and platform. 以下代码对igraph 0.6.5-2,R 3.0.1,OSX Lion而言对我来说很好用,因此,请包含一些可重现您问题的自包含代码,以及igraph和R版本和平台。 Thanks. 谢谢。

matrix1 <- as.matrix(read.table(header=TRUE, textConnection("
 var1 var2 var3 var4 var5 var6 var7 var8
 1.00 0.04 0.21 0.39 0.06 0.37 0.03 0.44
 0.04 1.00 0.34 0.36 0.63 0.25 0.66 0.18
 0.21 0.34 1.00 0.44 0.41 0.57 0.72 0.62
 0.39 0.36 0.44 1.00 0.28 0.14 0.51 0.10
 0.06 0.63 0.41 0.28 1.00 0.50 0.73 0.39
 0.37 0.25 0.57 0.14 0.50 1.00 0.50 0.65
 0.03 0.66 0.72 0.51 0.73 0.50 1.00 0.52
 0.44 0.18 0.62 0.10 0.39 0.65 0.50 1.00
")))

graph.adjacency(matrix1, mode='undirected', weighted=TRUE)
# IGRAPH UNW- 8 36 -- 
# + attr: name (v/c), weight (e/n)

I needed to remove all objects. 我需要删除所有对象。

Type in rm(list=ls()) . 输入rm(list=ls())

Then, the R scripts I used above should work. 然后,我上面使用的R脚本应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM