Skip to content

Commit

Permalink
Merge pull request #40 from SamGG/master
Browse files Browse the repository at this point in the history
Looks good. Thanks!
  • Loading branch information
gvegayon committed Jun 15, 2020
2 parents dd222bf + 49573a8 commit c76c790
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/read.gexf.R
Expand Up @@ -80,11 +80,17 @@ read.gexf <- function(x) {

# Nodes
nodes <- XML::getNodeSet(gfile,"/r:gexf/r:graph/r:nodes/r:node", c(r=ns))
ids <- sapply(nodes, XML::xmlGetAttr, name="id")
labels <- lapply(nodes, XML::xmlGetAttr, name="label")
labels <- sapply(labels, function(x) if (is.null(x)) "" else x)
if (all(labels == "")) labels <- ids
graph$nodes <- data.frame(
id=sapply(nodes, XML::xmlGetAttr, name="id"),
label=sapply(nodes, XML::xmlGetAttr, name="label"),
id=ids,
label=labels,
stringsAsFactors=F)
rm(nodes)
rm(ids)
rm(labels)

# Viz attributes -------------------------------------------------------------
nodesVizAtt <- NULL
Expand Down

0 comments on commit c76c790

Please sign in to comment.