d3plus
is an R package for seamless R and D3Plus
integration.
You can install d3plus
from Github with:
# install.packages("devtools")
::install_github("pachamaltese/d3plus") devtools
This is a basic example which shows you how to solve a common problem:
library(dplyr)
library(d3plus)
# examples taken from d3plus.org
<- tibble(id = c(rep("alpha",3),rep("beta",3)),
dta x = c(4,5,6,4,5,6),
y = c(7,25,13,7,8,13))
dta
d3plus() %>%
d3p_data(dta) %>%
d3p_type("line")
d3plus() %>%
d3p_data(dta) %>%
d3p_type("point")
<- tibble(id = c("alpha", "beta"), value = c(9, 20))
dta2
dta2
d3plus() %>%
d3p_data(dta2) %>%
d3p_type("treemap")
<- tibble(id = c("alpha", "alpha", "alpha", "beta", "beta", "beta"),
dta3 x = c(4,5,6,4,5,6),
y = c(7,25,13,7,8,13))
d3plus() %>%
d3p_data(dta3) %>%
d3p_type("bar")
d3plus() %>%
d3p_data(dta3) %>%
d3p_type("hbar")