Networks in HTLM

Networks in HTLM

Recently I gave a presentation about complexity in institutional networks for the Amazon in Colombia. For that I used the development version of the package reports. Which provides a nice and simple way to make fantastic and impressive presentations.

The core in the presentation were two networks representing a simple and a complex network using simulated data for government institutions in the Colombian Amazon. The nodes are: National parks, Environmental authorities, State governments, and Indian reserves.

The networks were simulated using the magic inside the package d3Network

A Simple Network

# Load RCurl package for downloading the data
library(bitops)
# library(RCurl)
library(d3Network)

datLinks<-read.csv(file="C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\MisLinks.csv",header=T)
datNodes<-read.csv(file="C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\MisNodes.csv",header=T)
datLinks$source<-as.numeric(datLinks$source)
datLinks$target<-as.numeric(datLinks$target)
datLinks$value<-as.numeric(datLinks$value)

network<-d3ForceNetwork(Links = datLinks, Nodes = datNodes, 
               Source = "source", Target = "target", 
               Value = "value", NodeID = "name", 
               Group = "group", width = 600, height = 300, 
               opacity = 0.9, 
               zoom = TRUE, 
                standAlone = FALSE,        
               # iframe = TRUE, #uncoment this line 
               linkColour = "#404040",    
              # file = "C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\ExampleGraph2.html" # uncoment if you want to save the html
                        )

Click to see the network

And the Complex Network

# Load RCurl package for downloading the data
library(bitops)
# library(RCurl)
library(d3Network)

datLinks<-read.csv(file="C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\MisLinks2.csv",header=T)
datNodes<-read.csv(file="C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\MisNodes2.csv",header=T)
datLinks$source<-as.numeric(datLinks$source)
datLinks$target<-as.numeric(datLinks$target)
datLinks$value<-as.numeric(datLinks$value)

network<-d3ForceNetwork(Links = datLinks, Nodes = datNodes, 
                        Source = "source", Target = "target", 
                        Value = "value", NodeID = "name", 
                        Group = "group", width = 600, height = 300, 
                        opacity = 0.9, 
                        # iframe = TRUE, #uncoment this line
                        linkColour = "#808080",
                        # file = "C:\\Users\\Diego\\Documents\\CodigoR\\Transparencia\\data\\ExampleGraph3.html"
                        )

Click to see the network

Move the mouse over the nodes. Click on it, drag and drop…

Impressive eh?

This post was made from R + knitr to WordPress.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s