Introduction

visNetwork is an R package for network visualization, using vis.js javascript library (http://visjs.org/). All remarks and bugs are welcome on github : https://github.com/datastorm-open/visNetwork.

Features

Based on htmlwidgets, so :

  • compatible with shiny, R Markdown documents, and RStudio viewer

The package proposes all the features available in vis.js API, and even more with special features for R :

  • easy to use
  • custom shapes, styles, colors, sizes, …
  • works smooth on any modern browser for up to a few thousand nodes and edges
  • interactivity controls (zoom, physics, movement of nodes, tooltip, events, …)

Installation

Package is now available on CRAN.

install.packages("visNetwork")

# can have new features in developpement version 
devtools::install_github("datastorm-open/visNetwork")

How it’s works ?

visNetwork needs at least two informations :

  • a nodes data.frame, with id column
  • a edges data.frame, with from and to columns, which make the link with id
require(visNetwork, quietly = TRUE)
# minimal example
nodes <- data.frame(id = 1:3)
edges <- data.frame(from = c(1,2), to = c(1,3))
visNetwork(nodes, edges, width = "100%")

Find help ?

Besides the help R functions, a vignette is available, and you can access and read the full javascript API from R using visDocumentation():

visDocumentation()
vignette("Introduction-to-visNetwork") # with CRAN version
# shiny example
shiny::runApp(system.file("shiny", package = "visNetwork"))

© 2016-2017 DataStorm

Fork me on GitHub