我的igraph库没有识别" graph_from_incidence_matrix()和graph_from_adjacency_matrix()"再来了(其他来自igraph的其他工作正常)。我已经卸载并重新安装了igraph,但仍然没有运气。这是一个例子:
library(igraph)
inc <- matrix(sample(0:1, 15, repl=TRUE), 3, 5)
colnames(inc) <- letters[1:5]
rownames(inc) <- LETTERS[1:3]
graph_from_incidence_matrix(inc)
Error: could not find function "graph_from_incidence_matrix"
感谢任何帮助。 更新:这是我的会议信息:
`R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] qgraph_1.3.1 R.matlab_3.2.0 igraph_0.7.1
loaded via a namespace (and not attached):
[1] acepack_1.3-3.3 cluster_2.0.1 colorspace_1.2-6 corpcor_1.6.7
[5] d3Network_0.5.2.1 digest_0.6.8 ellipse_0.3-8 fdrtool_1.2.14
[9] foreign_0.8-63 Formula_1.2-1 ggm_2.3 ggplot2_1.0.1
[13] glasso_1.8 grid_3.1.3 gridExtra_0.9.1 gtable_0.1.2
[17] gtools_3.4.2 Hmisc_3.16-0 huge_1.2.6 jpeg_0.1-8
[21] lattice_0.20-31 latticeExtra_0.6-26 lavaan_0.5-18 magrittr_1.5
[25] MASS_7.3-40 Matrix_1.2-0 matrixcalc_1.0-3 mnormt_1.5-2
[29] munsell_0.4.2 nnet_7.3-9 parallel_3.1.3 pbivnorm_0.6.0
[33] plyr_1.8.2 png_0.1-7 proto_0.3-10 psych_1.5.4
[37] quadprog_1.5-5 R.methodsS3_1.7.0 R.oo_1.19.0 R.utils_2.0.2
[41] RColorBrewer_1.1-2 Rcpp_0.11.6 reshape2_1.4.1 rjson_0.2.15
[45] rpart_4.1-9 scales_0.2.4 sem_3.1-5 sna_2.3-2
[49] splines_3.1.3 stats4_3.1.3 stringi_0.4-1 stringr_1.0.0
[53] survival_2.38-1 tools_3.1.3 whisker_0.3-2 `
答案 0 :(得分:1)
你确定你正确加载了库吗?目前,行
前面有一个&#39;library(igraph)
删除它并再次运行您的代码。在library() - 语句之后你应该得到类似于这个的东西:
Attach paket: ‘igraph’
The following objects are masked from ‘package:stats’:
decompose, spectrum
The following object is masked from ‘package:base’:
union
运行剩下的代码后,我得到以下输出:
IGRAPH 6798dd1 UN-B 8 6 --
+ attr: type (v/l), name (v/c)
+ edges from 6798dd1 (vertex names):
[1] A--a A--b A--c A--e B--b C--e