Originally, this package only dealt with the hierarchical data given by the structure of a folder, but now it can deal with any dataset with a hierarchical structure. It provides a Shiny application (see below). Also provides a function to get the tree view of a directory.
This package uses the DLL created by the Haskell libraries jsondirtree and jsondirtreeR. They are standalone on Windows.
library(dir2json)
dat <- tibble::tribble(
~level1, ~level2, ~level3, ~level4,
"Beverages", "Water", "", "",
"Beverages", "Coffee", "", "",
"Beverages", "Tea", "Black tea", "",
"Beverages", "Tea", "White tea", "",
"Beverages", "Tea", "Green tea", "Sencha",
"Beverages", "Tea", "Green tea", "Gyokuro",
"Beverages", "Tea", "Green tea", "Matcha",
"Beverages", "Tea", "Green tea", "Pi Lo Chun"
)
shinyDataTree(dat, root = FALSE)
This kind of tree is called a Reingold-Tilford tree network diagram. It is produced with the help of D3.js.