Running ‘rundemos.R’ [1s/1s]
Running the tests in ‘tests/rundemos.R’ failed.
Complete output:
  > library(rgexf)
  Loading required package: XML
  Loading required package: Rook
  Loading required package: igraph
  
  Attaching package: 'igraph'
  
  The following objects are masked from 'package:stats':
  
      decompose, spectrum
  
  The following object is masked from 'package:base':
  
      union
  
  > 
  > demo(edge.list)
  
  
  	demo(edge.list)
  	---- ~~~~~~~~~
  
  > ################################################################################
  > # Demo of gexf function - Input: a list of edges  
  > # Author: Jorge Fabrega
  > ################################################################################
  > pause <- function() {  
  +   invisible(readline("\nPress <return> to continue: ")) 
  + }
  
  > pause()
  
  Press <return> to continue: 
  
  > ## Demos for rgexf - Nodes and edges with attributes.
  > ## Input: A matrix of edges 
  > 
  > # Defining a matrix of edges
  > relations <- matrix(c("Juan","Carlos",
  +                       "Juan","Pedro",
  +                       "Juan","Matthew",
  +                       "Pedro","Matthew",
  +                       "Matthew","Carlos",
  +                       "Carlos","Pedro",
  +                       "Pedro","Carlos",
  +                       "Carlos","Juan",
  +                       "Carlos","Juan"),
  +                     ncol=2, byrow=T)
  
  > relations
        [,1]      [,2]     
   [1,] "Juan"    "Carlos" 
   [2,] "Juan"    "Pedro"  
   [3,] "Juan"    "Matthew"
   [4,] "Pedro"   "Matthew"
   [5,] "Matthew" "Carlos" 
   [6,] "Carlos"  "Pedro"  
   [7,] "Pedro"   "Carlos" 
   [8,] "Carlos"  "Juan"   
   [9,] "Carlos"  "Juan"   
  
  > # Now, with processEdgeList you can transform your edge list into a gexf file
  > 
  > pause()
  
  Press <return> to continue: 
  
  > edge.list(relations)
  $nodes
    id   label
  1  1  Carlos
  2  2    Juan
  3  3 Matthew
  4  4   Pedro
  
  $edges
        source target
   [1,]      2      1
   [2,]      2      4
   [3,]      2      3
   [4,]      4      3
   [5,]      3      1
   [6,]      1      4
   [7,]      4      1
   [8,]      1      2
   [9,]      1      2
  
  > demo(gexf)
  
  
  	demo(gexf)
  	---- ~~~~
  
  > ################################################################################
  > # Demo of gexf function
  > # Author: Jorge Fabrega
  > ################################################################################
  > pause <- function() {  
  +   invisible(readline("\nPress <return> to continue: ")) 
  + }
  
  > pause()
  
  Press <return> to continue: 
  
  > # Defining a matrix of nodes
  > pause()
  
  Press <return> to continue: 
  
  > people <- data.frame(id=1:4, label=c("juan", "pedro", "matthew", "carlos"))
  
  > people
    id   label
  1  1    juan
  2  2   pedro
  3  3 matthew
  4  4  carlos
  
  > # Defining a matrix of edges
  > pause()
  
  Press <return> to continue: 
  
  > relations <- data.frame(source=c(1,1,1,2,3,4,2,4,4), 
  +                         target=c(4,2,3,3,4,2,4,1,1))
  
  > relations
    source target
  1      1      4
  2      1      2
  3      1      3
  4      2      3
  5      3      4
  6      4      2
  7      2      4
  8      4      1
  9      4      1
  
  > # Defining a matrix of dynamics (start, end) for nodes and edges
  > pause()
  
  Press <return> to continue: 
  
  > time.nodes <- data.frame(matrix(c(10.0,13.0,2.0,2.0,12.0,rep(NA,3)),
  +                                 nrow=4, ncol=2))
  
  > time.nodes
    X1 X2
  1 10 12
  2 13 NA
  3  2 NA
  4  2 NA
  
  > time.edges<- data.frame(matrix(c(10.0,13.0,2.0,2.0,12.0,1,5,rep(NA,5),
  +                                  rep(c(0,1),3)), ncol=2))
  
  > time.edges
    X1 X2
  1 10 NA
  2 13 NA
  3  2 NA
  4  2  0
  5 12  1
  6  1  0
  7  5  1
  8 NA  0
  9 NA  1
  
  > # Defining a data frame of attributes for nodes and edges
  > pause()
  
  Press <return> to continue: 
  
  > node.att <- data.frame(letrafavorita=c(letters[1:3],"hola"), numbers=1:4)
  
  > node.att
    letrafavorita numbers
  1             a       1
  2             b       2
  3             c       3
  4          hola       4
  
  > edge.att <- data.frame(letrafavorita=letters[1:9], numbers=1:9)
  
  > edge.att
    letrafavorita numbers
  1             a       1
  2             b       2
  3             c       3
  4             d       4
  5             e       5
  6             f       6
  7             g       7
  8             h       8
  9             i       9
  
  > ################################################################################
  > # First example: a simple net
  > pause()
  
  Press <return> to continue: 
  
  > write.gexf(nodes=people, edges=relations)
  <?xml version="1.0" encoding="UTF-8"?>
  <gexf xmlns="http://www.gexf.net/1.2draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd" version="1.2">
    <meta lastmodifieddate="2018-10-21">
      <creator>NodosChile</creator>
      <description>A graph file writing in R using "rgexf"</description>
      <keywords>gexf graph, NodosChile, R, rgexf</keywords>
    </meta>
    <graph mode="static" defaultedgetype="undirected">
      <nodes>
        <node id="1" label="juan"/>
        <node id="2" label="pedro"/>
        <node id="3" label="matthew"/>
        <node id="4" label="carlos"/>
      </nodes>
      <edges>
        <edge id="0" source="1" target="4" weight="1"/>
        <edge id="1" source="1" target="2" weight="1"/>
        <edge id="2" source="1" target="3" weight="1"/>
        <edge id="3" source="2" target="3" weight="1"/>
        <edge id="4" source="3" target="4" weight="1"/>
        <edge id="5" source="4" target="2" weight="1"/>
        <edge id="6" source="2" target="4" weight="1"/>
        <edge id="7" source="4" target="1" weight="1"/>
        <edge id="8" source="4" target="1" weight="1"/>
      </edges>
    </graph>
  </gexf>
  
  > ################################################################################
  > # Second example: a simple net with nodes attributes
  > pause()
  
  Press <return> to continue: 
  
  > write.gexf(nodes=people, edges=relations, nodesAtt=node.att)
  <?xml version="1.0" encoding="UTF-8"?>
  <gexf xmlns="http://www.gexf.net/1.2draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd" version="1.2">
    <meta lastmodifieddate="2018-10-21">
      <creator>NodosChile</creator>
      <description>A graph file writing in R using "rgexf"</description>
      <keywords>gexf graph, NodosChile, R, rgexf</keywords>
    </meta>
    <graph mode="static" defaultedgetype="undirected">
      <attributes class="node" mode="static">
        <attribute id="att1" title="letrafavorita" type="string"/>
        <attribute id="att2" title="numbers" type="integer"/>
      </attributes>
      <nodes>
        <node id="1" label="juan">
          <attvalues>
            <attvalue for="att1" value="a"/>
            <attvalue for="att2" value="1"/>
          </attvalues>
        </node>
        <node id="2" label="pedro">
          <attvalues>
            <attvalue for="att1" value="b"/>
            <attvalue for="att2" value="2"/>
          </attvalues>
        </node>
        <node id="3" label="matthew">
          <attvalues>
            <attvalue for="att1" value="c"/>
            <attvalue for="att2" value="3"/>
          </attvalues>
        </node>
        <node id="4" label="carlos">
          <attvalues>
            <attvalue for="att1" value="hola"/>
            <attvalue for="att2" value="4"/>
          </attvalues>
        </node>
      </nodes>
      <edges>
        <edge id="0" source="1" target="4" weight="1"/>
        <edge id="1" source="1" target="2" weight="1"/>
        <edge id="2" source="1" target="3" weight="1"/>
        <edge id="3" source="2" target="3" weight="1"/>
        <edge id="4" source="3" target="4" weight="1"/>
        <edge id="5" source="4" target="2" weight="1"/>
        <edge id="6" source="2" target="4" weight="1"/>
        <edge id="7" source="4" target="1" weight="1"/>
        <edge id="8" source="4" target="1" weight="1"/>
      </edges>
    </graph>
  </gexf>
  
  > ################################################################################
  > # Third example: a simple net with dynamic nodes
  > pause()
  
  Press <return> to continue: 
  
  > write.gexf(nodes=people, edges=relations, nodeDynamic=time.nodes)
  Error in `[<-.data.frame`(`*tmp*`, is.na(nodeDynamic[, 1]), 1, value = "10") : 
    replacement has 1 row, data has 0
  Calls: demo ... eval -> eval -> write.gexf -> [<- -> [<-.data.frame
  Execution halted