Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/react-R/forcer
example React-based htmlwidget for react-force-graph
https://github.com/react-R/forcer
Last synced: 9 days ago
JSON representation
example React-based htmlwidget for react-force-graph
- Host: GitHub
- URL: https://github.com/react-R/forcer
- Owner: react-R
- License: other
- Created: 2019-01-12T14:38:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T03:05:29.000Z (almost 2 years ago)
- Last Synced: 2024-08-13T07:13:57.672Z (4 months ago)
- Language: R
- Size: 5.12 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - react-R/forcer - example React-based htmlwidget for react-force-graph (R)
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
**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`](https://github.com/vasturiano/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](https://react-r.github.io/reactR/articles/intro_htmlwidgets.html) for the steps to go from `React` component to fully functioning `htmlwidget`.
## Installation
Install the development version from [GitHub](https://github.com/) with:
``` r
# 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.
```{r example}
library(d3r)
library(igraph)
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
)
```... and for 3d and a-frame VR ...
```{r eval=FALSE}
# 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"
)```