Read gml file in R

11.2k Views Asked by At

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"

2

There are 2 best solutions below

0
On

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"), ...)
0
On

Version 1.5 of multiplex solved this bug.