Code Monkey home page Code Monkey logo

forcer's Introduction

For demonstration purposes - easy enough to turn into a CRAN-worthy package; let me know if you have interest

forcer

forcer is a quickly assembled htmlwidget for Vasco Asturiano’s react-force-graph. The package is designed to work but also primarily to demonstrate how to use reactR::scaffoldWidget to create an htmlwidget from a React component. Please see the tutorial htmlwidgets with reactR for the steps to go from React component to fully functioning htmlwidget.

Installation

Install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("react-R/forcer")

Example

Here are some very quick examples to demonstrate the three types of force-directed graphs provided.

library(d3r)
library(igraph)
#> Warning: package 'igraph' was built under R version 3.4.4
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
library(forcer)

# VR crashed my RStudio so open in real browser
options(viewer = NULL)

# 2D
forcer(
  data = d3r::d3_igraph(igraph::make_tree(60,3,mode="in")),
  forcetype = "ForceGraph2D",
  nodeColor = list("#0f0"),
  linkCurvature = 0.25
)
#> Warning: package 'bindrcpp' was built under R version 3.4.4

… and for 3d and a-frame VR …

# 3D
forcer(
  data = d3r::d3_igraph(igraph::make_tree(60,3)),
  forcetype = "ForceGraph3D"
)

# VR
forcer(
  data = d3r::d3_igraph(igraph::make_tree(60,3)),
  forcetype = "ForceGraphVR"
)

forcer's People

Contributors

timelyportfolio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.