Read gml file in R

假装没事ソ 提交于 2019-12-11 06:17:42

问题


i have problem when i try to read a gml file of political books dataset. i use the command:

hh=read.table("polbooks.gml")

Erreur dans scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : la ligne 2 n'avait pas 2 éléments

and when i use this one:

library(multiplex)
hh=read.gml("polbooks.gml")

Erreur dans (grep("graphics", edg, fixed = TRUE)[(i - 1)] + 2):(grep("graphics", : argument NA / NaN

i have this problem in every dataset ".gml"


回答1:


you can do like this,

 g<-read.graph("dolphins.gml",format=c("gml"))

and it's can be used for any foreign format: it's used the igraph package

 read.graph(file, format = c("edgelist", "pajek", "ncol", "lgl",
        "graphml", "dimacs", "graphdb", "gml", "dl"), ...)



回答2:


Version 1.5 of multiplex solved this bug.



来源:https://stackoverflow.com/questions/28964898/read-gml-file-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!