timelyportfolio / D3r

Licence: other
d3.js helpers for R

Programming Languages

javascript
184084 projects - #8 most used programming language
r
7636 projects

Projects that are alternatives of or similar to D3r

Dataexplorer
Automate Data Exploration and Treatment
Stars: ✭ 362 (+172.18%)
Mutual labels:  cran, rstats
Onnx R
R Interface to Open Neural Network Exchange (ONNX)
Stars: ✭ 31 (-76.69%)
Mutual labels:  cran, rstats
React D3 Tree
🌳 React component to create interactive D3 tree graphs
Stars: ✭ 543 (+308.27%)
Mutual labels:  hierarchy, d3
rchess
♛ Chess package for R
Stars: ✭ 68 (-48.87%)
Mutual labels:  cran, rstats
Pkgsearch
Search R packages on CRAN
Stars: ✭ 73 (-45.11%)
Mutual labels:  cran, rstats
ctv
CRAN Task View Initiative
Stars: ✭ 17 (-87.22%)
Mutual labels:  cran, rstats
Ggrepel
📍 Repel overlapping text labels away from each other.
Stars: ✭ 853 (+541.35%)
Mutual labels:  cran, rstats
Ngx Dynamic Dashboard Framework
This is a JSON driven angular x based dashboard framework that is inspired by JIRA's dashboard implementation and https://github.com/raulgomis/angular-dashboard-framework
Stars: ✭ 160 (+20.3%)
Mutual labels:  json, d3
Liger
Lightweight Iterative Gene set Enrichment in R
Stars: ✭ 44 (-66.92%)
Mutual labels:  cran, rstats
Ndjson
♨️ Wicked-Fast Streaming 'JSON' ('ndjson') Reader in R
Stars: ✭ 44 (-66.92%)
Mutual labels:  json, rstats
pbapply
Adding progress bar to '*apply' functions in R
Stars: ✭ 115 (-13.53%)
Mutual labels:  cran, rstats
Just Dashboard
📊 📋 Dashboards using YAML or JSON files
Stars: ✭ 1,511 (+1036.09%)
Mutual labels:  json, d3
heddlr
Bring a functional programming mindset to R Markdown document generation
Stars: ✭ 14 (-89.47%)
Mutual labels:  cran, rstats
cattonum
Encode Categorical Features
Stars: ✭ 31 (-76.69%)
Mutual labels:  cran, rstats
Elastic
R client for the Elasticsearch HTTP API
Stars: ✭ 227 (+70.68%)
Mutual labels:  json, rstats
Highcharter
R wrapper for highcharts
Stars: ✭ 583 (+338.35%)
Mutual labels:  cran, rstats
Collapse
Advanced and Fast Data Transformation in R
Stars: ✭ 184 (+38.35%)
Mutual labels:  cran, rstats
Reactr
React for R
Stars: ✭ 227 (+70.68%)
Mutual labels:  cran, rstats
Configr
Implements the JSON, INI, YAML and TOML parser, for R setting and writing of configuration file.
Stars: ✭ 38 (-71.43%)
Mutual labels:  json, cran
Refinr
Cluster and merge similar char values: an R implementation of Open Refine clustering algorithms
Stars: ✭ 91 (-31.58%)
Mutual labels:  cran, rstats

CRAN_Status_Badge Travis-CI Build Status Coverage Status

Why d3r?

Please see this Building Widgets blog post Why d3r?.

Installing d3r

d3r is on CRAN, so install with install.packages("d3r") or for the absolute latest use devtools.

devtools::install_github("timelyportfolio/d3r")

d3 Dependency Functions

d3r makes d3.js dependency injection in R easy with d3_dep_v3(), d3_dep_v4(), d3_dep_v5(), and the newest d3_dep_v6(). These functions work well with htmltools::tags.

library(htmltools)
library(d3r)

# check web developer tools to see d3 is available
browsable(
  attachDependencies(
    tagList(),
    d3_dep_v6()
  )
)

# or include directly in a taglist; I prefer this method.
browsable(
  tagList(
    h1("I have d3 version ", span(id="version")),
    tags$script("d3.select('#version').text(d3.version)"),
    d3_dep_v6()
  )
)

Also, I will commit to keeping d3r up-to-date with d3.js, so you’ll no longer need multiple copies of d3.js for your htmlwidgets. If you are a htmlwidget author, you will no longer need to worry every time d3.js gets a new release. See treebar lines for an example of using d3r with your htmlwidget.

d3 Hierarchy from data.frame

Building d3.js hierarchies can be very difficult. d3r::d3_nest() will convert table and data.frame to a nested d3.js hierarchy ready for work with d3-hierarchy.

d3_nest(as.data.frame(Titanic))

As another example, let’s go from treemap to d3.js.

library(treemap)
library(d3r)

d3_nest(
  treemap::random.hierarchical.data(),
  value_cols = "x"
)

d3 Hierarchy from partykit / rpart

rpart and similar objects in R are very difficult to convert but make perfect subjects for d3 hierarchical layouts. d3_party helps convert these objects for easy usage with d3.js.

#devtools::install_github("timelyportfolio/d3treeR")

library(d3treeR)
library(d3r)

# example from ?rpart
data("kyphosis", package="rpart")
rp <-  rpart::rpart(
  Kyphosis ~ Age + Number + Start,
  data = kyphosis
)

# get the json hierarchy
d3_party(tree=rp)

# interactive plot with d3treeR
d3tree2(
  d3_party(tree=rp),
  celltext="description",
  valueField="n"
)

d3 Network from igraph

igraph to d3.js network of nodes and links is a very common conversion. d3r::d3_igraph will do this for you.

library(igraph)
library(d3r)

d3_igraph(igraph::watts.strogatz.game(1, 50, 4, 0.05))

Todo

I have a whole lot of ideas. Please let me know yours, and let’s make this package great.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].