R igraph:graph_from_incidence_matrix()和graph_from_adjacency_matrix()不起作用 [英] R igraph : graph_from_incidence_matrix() and graph_from_adjacency_matrix() don't work

查看:254
本文介绍了R igraph:graph_from_incidence_matrix()和graph_from_adjacency_matrix()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的igraph库不再识别"graph_from_incidence_matrix()和graph_from_adjacency_matrix()"(igraph的其他所有功能都可以正常工作).我已经卸载并重新安装了igraph,但仍然没有运气.这是一个示例:

My igraph library doesn't recognize "graph_from_incidence_matrix() and graph_from_adjacency_matrix()" anymore (Everything else from igraph works fine). I've uninstalled and reinstalled igraph but still no luck. Here is an example:

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"

感谢您的帮助. 更新:这是我的会话信息:

Any help is appreciated. UPDATE: Here is my session info:

`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 `

推荐答案

确定要正确加载库吗?目前,该行的前面有'

are you sure you loaded the library correctly? at the moment there is a ' infront of the row

library(igraph)

删除该代码,然后再次运行您的代码.在library()语句之后,您应该获得与以下内容相似的内容:

remove that and run your code again. after the library()-statement you should get something similar to this one:

Attach paket: ‘igraph’

The following objects are masked from ‘package:stats’:

    decompose, spectrum

The following object is masked from ‘package:base’:

    union

运行其余代码后,我得到以下输出:

After running the rest of your code I get the following output:

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

这篇关于R igraph:graph_from_incidence_matrix()和graph_from_adjacency_matrix()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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