繁体   English   中英

R程序-igraph程序包错误

[英]R-program - igraph package error

当我尝试在我的Xubuntu VM中使用igraph库时,我在R程序中遇到了错误消息(请参见下面的代码\\详细信息)。 这个问题以前没有发生过。 一切都很好。

当我尝试在我的另一个新VM(Xubuntu)中重新设置R \\ igraph时,它就开始了。

有人可以给我有关如何解决此问题的任何建议吗?

以下是详细信息-

错误信息 -

Attaching package: ‘igraph’

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

    decompose, spectrum

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

    union

Loading required package: methods

Attaching package: ‘igraph’

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

    decompose, spectrum

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

    union

我如何安装R Base和Igraph-

    sudo apt-get -y install r-base
    sudo echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-     project.org'; options(repos = r);" > ~/.Rprofile

    sudo Rscript -e "install.packages('ggplot2')"
    sudo Rscript -e "install.packages('plyr')"

    sudo Rscript -e "install.packages('reshape2')"

    sudo Rscript -e "install.packages('igraph')"

    sudo Rscript -e "install.packages('doBy')"

sudo Rscript -e "install.packages('stargazer')"

我的R-程序

library(igraph)
g <- read.graph("DataForImage.net", format="pajek")
g <- delete.vertices(g,which(degree(g)<1))
jpeg(filename = "Image1.jpg", width = 2000, height = 2000,
     units = "px", pointsize = 10, bg = "white",
     res = NA)
g <- simplify(g)
l <- layout.fruchterman.reingold(g, dim=2,verbose=TRUE)
l <- layout.norm(l, -1,1, -1,1)
fcs <- fastgreedy.community(simplify(as.undirected(g)))
Q <- round(max(fcs$modularity), 3)
fcs <- community.to.membership(g, fcs$merges, steps=which.max(fcs$modularity)-1 )
plot(g, layout=l,vertex.shape="circle", vertex.size=2, vertex.label=NA, vertex.color="black",
    vertex.frame.color="black", edge.width=5,
    rescale=FALSE, xlim=range(l[,1]), ylim=range(l[,2]),
    main="")
results <- read.table("detailTotals.csv", header=TRUE, sep=",")
jpeg(filename = "Image2.jpg", width = 2000, height = 2000,
    units = "px", pointsize = 50, bg = "white",
    res = NA)
plot(results$SetLineTotal, results$SetCount,  main="Set Analysis", 
xlab="Set Lines", ylab="Set Counts", col="black", bg="black", pch=21, cex=1) 
grid(nx = 50, ny = 50, col = "lightgray", lty = "dotted", lwd = par("lwd"), equilogs = TRUE)

我以为我会分享似乎对我有用的最终解决方案。 我进行了深入挖掘,并经过一些分析,发现了以下内容。 该错误似乎与igraph版本-V1.0有关。 以上R中的代码语句-程序

l <- layout.fruchterman.reingold(g, dim=2,verbose=TRUE)

igraph V1.0中的错误。

R-igraph包被重写-从而从较新的igraph版本-1.0开始对旧版本的某些功能\\网络算法进行了替换\\重新编码\\修改。 因此,我恢复使用了较早的igraph软件包(0.7.1),现在我不再面对这个问题。 而且我的R程序似乎运行良好。 以下是恢复到较早的igraph软件包0.7.1的命令

wget http://cran.r-project.org/src/contrib/Archive/igraph/igraph_0.7.1.tar.gz
sudo R CMD INSTALL igraph_0.7.1.tar.gz

暂无
暂无

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

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