diff --git a/README.Rmd b/README.Rmd
index f11e861..922716a 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -68,11 +68,44 @@ citation(package="rgexf")
# Examples
-## Example 1: Static net ##
-```{r}
+## Example 1: Importing GEXF files
+
+We can use the `read.gexf` function to read GEXF files into R:
+
+```{r read-lesmiserables}
# Loading the package
library(rgexf)
+g <- system.file("gexf-graphs/lesmiserables.gexf", package="rgexf")
+g <- read.gexf(g)
+head(g) # Taking a look at the first handful
+```
+
+Moreover, we can use the `gexf.to.igraph()` function to convert the
+`gexf` object into an `igraph` object:
+
+```{r igraph}
+library(igraph)
+ig <- gexf.to.igraph(g)
+
+op <- par(mai = rep(0, 4)) # Making room
+plot(ig)
+par(op)
+```
+
+
+Using the `plot.gexf` method--which uses the `gexf-js` JavaScript library--results
+in a Web visualization of the graph, like this:
+
+```r
+plot(g)
+```
+![](inst/gexf-graphs/lesmiserables.png)
+
+An live version of the figure is available [here](https://gvegayon.github.io/rgexf/lesmiserables).
+
+## Example 2: Static net ##
+```{r}
# Creating a group of individuals and their relations
people <- data.frame(matrix(c(1:4, 'juan', 'pedro', 'matthew', 'carlos'),ncol=2))
people
@@ -90,7 +123,7 @@ write.gexf(people, relations)
```
-## Example 2: Dynamic net ##
+## Example 3: Dynamic net ##
```{r}
# Defining the dynamic structure, note that there are some nodes that have NA at the end.
@@ -105,7 +138,7 @@ write.gexf(people, relations, nodeDynamic=time)
-## Example 3: More complex... Dynamic graph with attributes both for nodes and edges##
+## Example 4: More complex... Dynamic graph with attributes both for nodes and edges##
First we define dynamics
@@ -132,29 +165,8 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
edgesAtt=edge.att, nodeDynamic=time.nodes, nodesAtt=node.att)
```
-## Example 4: Importing GEXF files
-
-We can use the `read.gexf` function to read GEXF files into R:
-
-```{r read-lesmiserables}
-g <- system.file("gexf-graphs/lesmiserables.gexf", package="rgexf")
-g <- read.gexf(g)
-head(g) # Taking a look at the first handful
-```
-
-Moreover, we can use the `gexf.to.igraph()` function to convert the
-`gexf` object into an `igraph` object:
-
-```{r igraph}
-library(igraph)
-ig <- gexf.to.igraph(g)
-op <- par(mai = rep(0, 4)) # Making room
-plot(ig)
-par(op)
-```
-An example of the plot method using the `gexf-js` JavaScript library is available [here](https://gvegayon.github.io/rgexf/lesmiserables)
# Code of Conduct
diff --git a/README.md b/README.md
index 16c2ef2..00ff783 100644
--- a/README.md
+++ b/README.md
@@ -109,12 +109,138 @@ citation(package="rgexf")
# Examples
-## Example 1: Static net
+## Example 1: Importing GEXF files
+
+We can use the `read.gexf` function to read GEXF files into R:
``` r
# Loading the package
library(rgexf)
+g <- system.file("gexf-graphs/lesmiserables.gexf", package="rgexf")
+g <- read.gexf(g)
+head(g) # Taking a look at the first handful
+```
+
+ ##
+ ##
+ ##
+ ## Gephi 0.9
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ## ...
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ##
+ ## ...
+ ##
+ ##
+ ##
+
+Moreover, we can use the `gexf.to.igraph()` function to convert the
+`gexf` object into an `igraph` object:
+
+``` r
+library(igraph)
+```
+
+ ##
+ ## Attaching package: 'igraph'
+
+ ## The following objects are masked from 'package:stats':
+ ##
+ ## decompose, spectrum
+
+ ## The following object is masked from 'package:base':
+ ##
+ ## union
+
+``` r
+ig <- gexf.to.igraph(g)
+
+op <- par(mai = rep(0, 4)) # Making room
+plot(ig)
+```
+
+![](man/figures/igraph-1.png)
+
+``` r
+par(op)
+```
+
+Using the `plot.gexf` method–which uses the `gexf-js` JavaScript
+library–results in a Web visualization of the graph, like this:
+
+``` r
+plot(g)
+```
+
+![](inst/gexf-graphs/lesmiserables.png)
+
+An live version of the figure is available
+[here](https://gvegayon.github.io/rgexf/lesmiserables).
+
+## Example 2: Static net
+
+``` r
# Creating a group of individuals and their relations
people <- data.frame(matrix(c(1:4, 'juan', 'pedro', 'matthew', 'carlos'),ncol=2))
people
@@ -156,22 +282,22 @@ write.gexf(people, relations)
##
##
##
- ##
+ ##
##
##
##
##
- ##
+ ##
##
##
##
##
- ##
+ ##
##
##
##
##
- ##
+ ##
##
##
##
@@ -187,7 +313,7 @@ write.gexf(people, relations)
##
##
-## Example 2: Dynamic net
+## Example 3: Dynamic net
``` r
# Defining the dynamic structure, note that there are some nodes that have NA at the end.
@@ -222,17 +348,17 @@ write.gexf(people, relations, nodeDynamic=time)
##
##
##
- ##
+ ##
##
##
##
##
- ##
+ ##
##
##
##
##
- ##
+ ##
##
##
##
@@ -248,7 +374,7 @@ write.gexf(people, relations, nodeDynamic=time)
##
##
-## Example 3: More complex… Dynamic graph with attributes both for nodes and edges
+## Example 4: More complex… Dynamic graph with attributes both for nodes and edges
First we define dynamics
@@ -332,7 +458,7 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
##
##
##
- ##
+ ##
##
##
##
@@ -341,7 +467,7 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
##
##
##
- ##
+ ##
##
##
##
@@ -350,7 +476,7 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
##
##
##
- ##
+ ##
##
##
##
@@ -359,7 +485,7 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
##
##
##
- ##
+ ##
##
##
##
@@ -405,123 +531,6 @@ write.gexf(nodes=people, edges=relations, edgeDynamic=time.edges,
##
##
-## Example 4: Importing GEXF files
-
-We can use the `read.gexf` function to read GEXF files into R:
-
-``` r
-g <- system.file("gexf-graphs/lesmiserables.gexf", package="rgexf")
-g <- read.gexf(g)
-head(g) # Taking a look at the first handful
-```
-
- ##
- ##
- ##
- ## Gephi 0.9
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ## ...
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ##
- ## ...
- ##
- ##
- ##
-
-Moreover, we can use the `gexf.to.igraph()` function to convert the
-`gexf` object into an `igraph` object:
-
-``` r
-library(igraph)
-```
-
- ##
- ## Attaching package: 'igraph'
-
- ## The following objects are masked from 'package:stats':
- ##
- ## decompose, spectrum
-
- ## The following object is masked from 'package:base':
- ##
- ## union
-
-``` r
-ig <- gexf.to.igraph(g)
-
-op <- par(mai = rep(0, 4)) # Making room
-plot(ig)
-```
-
-![](man/figures/igraph-1.png)
-
-``` r
-par(op)
-```
-
-An example of the plot method using the `gexf-js` JavaScript library is
-available [here](https://gvegayon.github.io/rgexf/lesmiserables)
-
# Code of Conduct
We welcome contributions to `rgexf`. Whether reporting a bug, starting a
diff --git a/inst/gexf-graphs/lesmiserables.png b/inst/gexf-graphs/lesmiserables.png
new file mode 100644
index 0000000..29944d3
Binary files /dev/null and b/inst/gexf-graphs/lesmiserables.png differ
diff --git a/vignettes/rgexf.Rmd b/vignettes/rgexf.Rmd
index b08666f..7bb7bcf 100644
--- a/vignettes/rgexf.Rmd
+++ b/vignettes/rgexf.Rmd
@@ -63,7 +63,19 @@ We can also go back:
head(igraph.to.gexf(lesmi_ig))
```
-An example of the plot method using the `gexf-js` JavaScript library is available [here](https://gvegayon.github.io/rgexf/lesmiserables)
+
+Using the `plot.gexf` method--which uses the `gexf-js` JavaScript library--results
+in a Web visualization of the graph, like this:
+
+```r
+plot(g)
+```
+
+```{r gexf-js, echo = FALSE}
+knitr::include_graphics(path = system.file("gexf-graphs/lesmiserables.png", package="rgexf"))
+```
+
+An live version of the figure is available [here](https://gvegayon.github.io/rgexf/lesmiserables).
# Creating GEXF files