use of interactive dendogram

library(collapsibleTree)
library(tidyverse)
## -- Attaching packages -------------------------------------- tidyverse 1.3.0 --
## <U+2713> ggplot2 3.2.1     <U+2713> purrr   0.3.3
## <U+2713> tibble  2.1.3     <U+2713> dplyr   0.8.3
## <U+2713> tidyr   1.0.0     <U+2713> stringr 1.4.0
## <U+2713> readr   1.3.1     <U+2713> forcats 0.4.0
## -- Conflicts ----------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
head(warpbreaks)
##   breaks wool tension
## 1     26    A       L
## 2     30    A       L
## 3     54    A       L
## 4     25    A       L
## 5     70    A       L
## 6     52    A       L
table(warpbreaks$wool)
## 
##  A  B 
## 27 27
table(warpbreaks$tension)
## 
##  L  M  H 
## 18 18 18
p <- collapsibleTree( warpbreaks, c("wool", "tension", "breaks"))
p

There is no tooltip in this data. Further, it is a tidy data. Adding tooltip in the dendogram

collapsibleTreeSummary(
  warpbreaks,
  c("wool", "tension", "breaks"),
  attribute = "breaks",
  maxPercent = 50
)

using this on iris data

### tidying data
Iris<-iris%>%
  pivot_longer(-Species,names_to = "Type",values_to = "values")
p1<-collapsibleTreeSummary(Iris,
                           c("Species", "Type", "values"),
                           attribute = "values",
                           maxPercent = 50
)
p1

Use of collapsableTreeNetwork

# Create a simple org chart
org <- data.frame(
Manager = c(
NA, "Ana", "Ana", "Bill", "Bill", "Bill", "Claudette", "Claudette", "Danny",
"Fred", "Fred", "Grace", "Larry", "Larry", "Nicholas", "Nicholas"
),
Employee = c(
"Ana", "Bill", "Larry", "Claudette", "Danny", "Erika", "Fred", "Grace",
"Henri", "Ida", "Joaquin", "Kate", "Mindy", "Nicholas", "Odette", "Peter"
),
Title = c(
"President", "VP Operations", "VP Finance", "Director", "Director", "Scientist",
"Manager", "Manager", "Jr Scientist", "Operator", "Operator", "Associate",
"Analyst", "Director", "Accountant", "Accountant"
)
)
collapsibleTreeNetwork(org, attribute = "Title")
# Add in colors and sizes
org$Color <- org$Title
levels(org$Color) <- colorspace::rainbow_hcl(11)
collapsibleTreeNetwork(
org,
attribute = "Title",
fill = "Color",
nodeSize = "leafCount"

)

The node size is proportion to number of subsequent node counts each node is having.