This collapsibleTree R package intrigues me. It was written and hosted by AdeelK93 at https://github.com/AdeelK93/collapsibleTree. Here I hope to use the design to explore my organization of topics for my first-semester Calculus course.


Making the Data

I quickly remade my topics list in Excel with a tree diagram in mind.

library("dplyr")
library("readxl")

Math11 <- tbl_df(read_excel("Math11Table.xlsx"))
Math11
## # A tibble: 39 × 3
##                         Topic      Pillar       Branch
##                         <chr>       <chr>        <chr>
## 1            One-Sided Limits      Limits   Structures
## 2          Limits at Infinity      Limits   Structures
## 3                  Continuity      Limits Applications
## 4  Intermediate Value Theorem      Limits Applications
## 5               Differentials Derivatives   Structures
## 6   The Derivative at a Point Derivatives   Structures
## 7     The Derivative Function Derivatives   Structures
## 8           Differentiability Derivatives   Structures
## 9   Polynomials and Concavity Derivatives   Structures
## 10      Exponential Functions Derivatives   Structures
## # ... with 29 more rows

Making the Tree

The collapsibleTree package and function allows users to make a neat tree diagram without having to worry about Javascript, JSON, etc.

library("collapsibleTree")

collapsibleTree(Math11,
                #attribute = "Number of Topics",
                fill = c(
                  # The root
                  "black",
                  # Pillars
                  rep("blue", length(unique(Math11$Pillar))),
                  # Branches
                  rep("yellow", length(unique(paste(Math11$Pillar, Math11$Branch)))),
                  # Topics
                  rep("green", length(unique(paste(Math11$Pillar, Math11$Branch, Math11$Topic))))),
                hierarchy = c("Pillar", "Branch", "Topic"),
                width = 800)