Title

This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages (click the MD toolbar button for help on Markdown).

When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library('igraph')
## Warning: package 'igraph' was built under R version 3.1.3
## 
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## The following object is masked from 'package:base':
## 
##     union
library('network') 
## Warning: package 'network' was built under R version 3.1.3
## network: Classes for Relational Data
## Version 1.13.0 created on 2015-08-31.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##                     Mark S. Handcock, University of California -- Los Angeles
##                     David R. Hunter, Penn State University
##                     Martina Morris, University of Washington
##                     Skye Bender-deMoll, University of Washington
##  For citation information, type citation("network").
##  Type help("network-package") to get started.
## 
## Attaching package: 'network'
## The following objects are masked from 'package:igraph':
## 
##     %c%, %s%, add.edges, add.vertices, delete.edges,
##     delete.vertices, get.edge.attribute, get.edges,
##     get.vertex.attribute, is.bipartite, is.directed,
##     list.edge.attributes, list.vertex.attributes,
##     set.edge.attribute, set.vertex.attribute
library('sna')
## Warning: package 'sna' was built under R version 3.1.3
## sna: Tools for Social Network Analysis
## Version 2.3-2 created on 2014-01-13.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
## 
## Attaching package: 'sna'
## The following object is masked from 'package:network':
## 
##     %c%
## The following objects are masked from 'package:igraph':
## 
##     %c%, betweenness, bonpow, closeness, components, degree,
##     dyad.census, evcent, hierarchy, is.connected, neighborhood,
##     triad.census
library('ndtv')
## Warning: package 'ndtv' was built under R version 3.1.3
## Loading required package: networkDynamic
## Warning: package 'networkDynamic' was built under R version 3.1.3
## 
## networkDynamic: version 0.9.0, created on 2016-01-12
## Copyright (c) 2016, Carter T. Butts, University of California -- Irvine
##                     Ayn Leslie-Cook, University of Washington
##                     Pavel N. Krivitsky, University of Wollongong
##                     Skye Bender-deMoll, University of Washington
##                     with contributions from
##                     Zack Almquist, University of California -- Irvine
##                     David R. Hunter, Penn State University
##                     Li Wang
##                     Kirk Li, University of Washington
##                     Steven M. Goodreau, University of Washington
##                     Jeffrey Horner
##                     Martina Morris, University of Washington
## Based on "statnet" project software (statnet.org).
## For license and citation information see statnet.org/attribution
## or type citation("networkDynamic").
## Loading required package: animation
## Warning: package 'animation' was built under R version 3.1.3
## 
## ndtv: version 0.9.0, created on 2016-2-18
## Copyright (c) 2016, Skye Bender-deMoll, University of Washington
##                     with contributions from
##                     Martina Morris, University of Washington
## Based on "statnet" project software (statnet.org).
## For license and citation information see statnet.org/attribution
## or type citation("ndtv").
library('visNetwork')
## Warning: package 'visNetwork' was built under R version 3.1.3
## 
## Attaching package: 'visNetwork'
## The following object is masked from 'package:igraph':
## 
##     %>%
library('reshape')
## Warning: package 'reshape' was built under R version 3.1.3
setwd("C:/Users/zul/Documents/network")
library(reshape)
d=read.csv("mat1.csv",header=F)
m <- as.matrix(d)
m2 <- melt(m)[melt(upper.tri(m))$value,]
names(m2) <- c("from","to", "value")
m2=as.data.frame(m2)
m2$to=substr(m2$to,2,2)
edges=m2
nb <- 4
nodes <- data.frame(id = 1:nb, label = paste("Label", 1:nb),
 group = sample(LETTERS[1:3], nb, replace = TRUE), value = 1:nb,
 title = paste0("<p>", 1:nb,"<br>Tooltip !</p>"), stringsAsFactors = FALSE)
 
nodes=nodes[,1:2]
visNetwork(nodes, edges, height = "500px", width = "100%") %>% 
  visOptions(highlightNearest = TRUE) %>%
  visLayout(randomSeed = 123)

You can also embed plots, for example: