Problems using Sankey and d3tree htmlwidgets at the same time on R Notebook?
I am using R laptop for data analysis. I want to do Sankey and d3tree htmlwidgets on an R laptop at the same time.
I put snakey and then d3tree sample code in r chunk, output printed nicely on rstudio
When I entered the preview button, the sankey output appeared well in the html.
But the d3tree output is not being output to html.
I tried to put d3tree and then sankey. the result is that two of d3tree and sankey dosen't render to html.
What is the problem? Can I solve these problems?
example code as shown below
---
title: "test"
output: html_notebook
---
```{r, echo=FALSE}
library(networkD3)
library(treemap)
library(d3treeR)
```
```{r, echo=FALSE}
net_cycles <- list(
links = data.frame(
source = c(0,0,0,1,1,5),
target = c(1,2,3,4,5,0),
value = 10
),
nodes = data.frame(
name = letters[1:6]
)
)
```
```{r, echo=FALSE}
data(business)
business$employees.growth <- business$employees - business$employees.prev
tree <- treemap(business,
index=c("NACE1", "NACE2"),
vSize="employees",
vColor="employees.growth",
type="value",
palette="-RdGy",
range=c(-30000,30000))
```
```{r}
sankeyNetwork(
net_cycles$links,
net_cycles$nodes,
Value = "value"
)
d3tree2(
# Brewer Red-White-Grey palette reversed with predefined range
tree
,rootname = "World"
)
```
+3
source to share
No one has answered this question yet
Check out similar questions: