0
> library(XML)
> tdoc <- xmlParse("http://gexf.net/data/dynamics_openintervals.gexf")
> getNodeSet(tdoc,"/gexf/graph/nodes/node")
list()
attr(,"class")
[1] "XMLNodeSet"

I expect it to return a list of two objects, but it just returns an empty list. Here is the example GEXF file I'm working with: http://gexf.net/data/dynamics_openintervals.gexf

Jesse
  • 388
  • 6
  • 16

2 Answers2

2

Figured this one out. Needed to define the namespace.

> library(XML)
> tdoc <- xmlParse("http://gexf.net/data/dynamics_openintervals.gexf")
> getNodeSet(tdoc,"//gexf:node",
    c(gexf="http://www.gexf.net/1.2draft")
Jesse
  • 388
  • 6
  • 16
1

You should try "rgexf" library (http://cran.r-project.org/web/packages/rgexf/). There you will find the function "read.gexf". Following your example:

library(rgexf)

mygraph <- read.gexf("http://gexf.net/data/dynamics_openintervals.gexf")

This will return a gexf graph object. Try summarizing it

summary(mygraph)

Let me know if it helps

Best wishes

George Author of rgexf

gvegayon
  • 812
  • 12
  • 23
  • Yes. I've used it. It's a great package - have an upvote. The problem I had though is that I needed to do node and edge spells, which your package currently does not support. – Jesse Mar 01 '13 at 18:47
  • Good news, next version will support this :). I'm planning plublish it this week. If you have any suggestions just let me know :). – gvegayon Mar 03 '13 at 22:52